Merge pull request #5295 from MrPetovan/task/4889-move-config-to-config
Move configuration to config/
This commit is contained in:
commit
66a103e36a
116 changed files with 1900 additions and 1294 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
@ -2,20 +2,22 @@ favicon.*
|
||||||
.htconfig.php
|
.htconfig.php
|
||||||
.htpreconfig.php
|
.htpreconfig.php
|
||||||
\#*
|
\#*
|
||||||
include/jquery-1.4.2.min.js
|
|
||||||
*.log
|
*.log
|
||||||
*.out
|
*.out
|
||||||
*.version*
|
*.version*
|
||||||
favicon.*
|
|
||||||
home.html
|
home.html
|
||||||
addon
|
|
||||||
*~
|
*~
|
||||||
robots.txt
|
robots.txt
|
||||||
|
|
||||||
#ignore documentation, it should be newly built
|
#ignore local config
|
||||||
doc/html
|
/config/local.ini.php
|
||||||
|
/config/addon.ini.php
|
||||||
|
|
||||||
#ignore reports, should be generted with every build
|
#ignore documentation, it should be newly built
|
||||||
|
/doc/html
|
||||||
|
|
||||||
|
#ignore reports, should be generated with every build
|
||||||
report/
|
report/
|
||||||
|
|
||||||
#ignore config files from eclipse, we don't want IDE files in our repository
|
#ignore config files from eclipse, we don't want IDE files in our repository
|
||||||
|
@ -61,5 +63,6 @@ venv/
|
||||||
#ignore config files from JetBrains
|
#ignore config files from JetBrains
|
||||||
/.idea
|
/.idea
|
||||||
|
|
||||||
#ignore addons/ directory
|
#ignore addons directory
|
||||||
addons/
|
/addons
|
||||||
|
/addon
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
language: php
|
language: php
|
||||||
## Friendica supports PHP version >= 5.6
|
## Friendica supports PHP version >= 5.6.1
|
||||||
php:
|
php:
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
|
@ -17,7 +17,9 @@ env:
|
||||||
install:
|
install:
|
||||||
- composer install
|
- composer install
|
||||||
before_script:
|
before_script:
|
||||||
|
- cp config/local-sample.ini.php config/local.ini.php
|
||||||
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
- mysql -e 'CREATE DATABASE IF NOT EXISTS test;'
|
||||||
- mysql -utravis test < database.sql
|
- mysql -utravis test < database.sql
|
||||||
- echo "extension=redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
- echo "extension=redis.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
- echo "extension=memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
- echo "extension=memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||||
|
|
||||||
|
|
34
INSTALL.txt
34
INSTALL.txt
|
@ -32,7 +32,7 @@ link if your cert is self-signed).
|
||||||
- Apache with mod-rewrite enabled and "Options All" so you can use a
|
- Apache with mod-rewrite enabled and "Options All" so you can use a
|
||||||
local .htaccess file
|
local .htaccess file
|
||||||
|
|
||||||
- PHP 5.6+ (PHP 7 recommended for performance).
|
- PHP 5.6.1+ (PHP 7 recommended for performance).
|
||||||
|
|
||||||
- PHP *command line* access with register_argc_argv set to true in the
|
- PHP *command line* access with register_argc_argv set to true in the
|
||||||
php.ini file [or see 'poormancron' in section 8]
|
php.ini file [or see 'poormancron' in section 8]
|
||||||
|
@ -85,7 +85,7 @@ Clone the addon repository (separately):
|
||||||
|
|
||||||
git clone https://github.com/friendica/friendica-addons.git -b master addon
|
git clone https://github.com/friendica/friendica-addons.git -b master addon
|
||||||
|
|
||||||
If you copy the directory tree to your webserver, make sure that you also
|
If you copy the directory tree to your webserver, make sure that you also
|
||||||
copy .htaccess - as "dot" files are often hidden and aren't normally copied.
|
copy .htaccess - as "dot" files are often hidden and aren't normally copied.
|
||||||
|
|
||||||
If you want to use the development version of Friendica you can switch to
|
If you want to use the development version of Friendica you can switch to
|
||||||
|
@ -106,8 +106,8 @@ password, database name).
|
||||||
- Please check the additional notes if running on MySQ 5.7.17 or newer
|
- Please check the additional notes if running on MySQ 5.7.17 or newer
|
||||||
|
|
||||||
4. If you know in advance that it will be impossible for the web server to
|
4. If you know in advance that it will be impossible for the web server to
|
||||||
write or create files in your web directory, create an empty file called
|
write or create files in the config/ subfolder, create an empty file called
|
||||||
.htconfig.php and make it writable by the web server.
|
local.ini.php and make it writable by the web server.
|
||||||
|
|
||||||
5. Visit your website with a web browser and follow the instructions. Please
|
5. Visit your website with a web browser and follow the instructions. Please
|
||||||
note any error messages and correct these before continuing.
|
note any error messages and correct these before continuing.
|
||||||
|
@ -121,9 +121,9 @@ so in the host name setting for the database.
|
||||||
|
|
||||||
6. *If* the automated installation fails for any reason, check the following:
|
6. *If* the automated installation fails for any reason, check the following:
|
||||||
|
|
||||||
- ".htconfig.php" exists
|
- "config/local.ini.php" exists
|
||||||
If not, edit htconfig.php and change system settings. Rename
|
If not, edit local-sample.ini.php and change system settings. Rename
|
||||||
to .htconfig.php
|
to local.ini.php
|
||||||
- Database is populated.
|
- Database is populated.
|
||||||
If not, import the contents of "database.sql" with phpmyadmin
|
If not, import the contents of "database.sql" with phpmyadmin
|
||||||
or mysql command line
|
or mysql command line
|
||||||
|
@ -132,7 +132,7 @@ or mysql command line
|
||||||
Registration errors should all be recoverable automatically.
|
Registration errors should all be recoverable automatically.
|
||||||
If you get any *critical* failure at this point, it generally indicates the
|
If you get any *critical* failure at this point, it generally indicates the
|
||||||
database was not installed correctly. You might wish to move/rename
|
database was not installed correctly. You might wish to move/rename
|
||||||
.htconfig.php to another name and empty (called 'dropping') the database
|
local.ini.php to another name and empty (called 'dropping') the database
|
||||||
tables, so that you can start fresh.
|
tables, so that you can start fresh.
|
||||||
|
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
|
@ -177,7 +177,7 @@ Bad things will happen. Let there be a hardware failure, a corrupted
|
||||||
database or whatever you can think of. So once the installation of your
|
database or whatever you can think of. So once the installation of your
|
||||||
Friendica node is done, you should make yoursef a backup plan.
|
Friendica node is done, you should make yoursef a backup plan.
|
||||||
|
|
||||||
The most important file is the `.htconfig.php` file in the base directory.
|
The most important file is the `config/local.ini.php` file in the base directory.
|
||||||
As it stores all your data, you should also have a recent dump of your
|
As it stores all your data, you should also have a recent dump of your
|
||||||
Friendica database at hand, should you have to recover your node.
|
Friendica database at hand, should you have to recover your node.
|
||||||
|
|
||||||
|
@ -274,21 +274,21 @@ Windows).
|
||||||
|
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
- If you are unable to write the file .htconfig.php during installation
|
- If you are unable to write the file config/local.ini.php during installation
|
||||||
due to permissions issues:
|
due to permissions issues:
|
||||||
#####################################################################
|
#####################################################################
|
||||||
|
|
||||||
create an empty file with that name and give it world-write permission.
|
create an empty file with that name and give it world-write permission.
|
||||||
For Linux:
|
For Linux:
|
||||||
|
|
||||||
% touch .htconfig.php
|
% touch config/local.ini.php
|
||||||
% chmod 777 .htconfig.php
|
% chmod 664 config/local.ini.php
|
||||||
|
|
||||||
Retry the installation. As soon as the database has been created,
|
Retry the installation. As soon as the database has been created,
|
||||||
|
|
||||||
******* this is important *********
|
******* this is important *********
|
||||||
|
|
||||||
% chmod 755 .htconfig.php
|
% chmod 644 config/local.ini.php
|
||||||
|
|
||||||
#####################################################################
|
#####################################################################
|
||||||
- Some configurations with "suhosin" security are configured without
|
- Some configurations with "suhosin" security are configured without
|
||||||
|
@ -327,11 +327,11 @@ After a while I noticed, that bin/worker.php calls further php script via
|
||||||
proc_open. These scripts themselves also use proc_open and fail, because they
|
proc_open. These scripts themselves also use proc_open and fail, because they
|
||||||
are NOT called with -d suhosin.executor.func.blacklist=none.
|
are NOT called with -d suhosin.executor.func.blacklist=none.
|
||||||
|
|
||||||
So the simple solution is to put the correct parameters into .htconfig.php:
|
So the simple solution is to put the correct parameters into config/local.ini.php:
|
||||||
// Location of PHP command line processor
|
|
||||||
$a->config['php_path'] = '/usr/bin/php -d suhosin.executor.func.blacklist=none
|
|
||||||
-d suhosin.executor.eval.blacklist=none';
|
|
||||||
|
|
||||||
|
[config]
|
||||||
|
; Location of PHP command line processor
|
||||||
|
php_path = "/usr/bin/php -d suhosin.executor.func.blacklist=none -d suhosin.executor.eval.blacklist=none"
|
||||||
|
|
||||||
This is obvious as soon as you notice that the friendica-cron uses proc_open to
|
This is obvious as soon as you notice that the friendica-cron uses proc_open to
|
||||||
execute php-scripts that also use proc_open, but it took me quite some time to
|
execute php-scripts that also use proc_open, but it took me quite some time to
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseObject;
|
|
||||||
use Friendica\Core\Config;
|
|
||||||
use Friendica\Util\ExAuth;
|
use Friendica\Util\ExAuth;
|
||||||
|
|
||||||
if (sizeof($_SERVER["argv"]) == 0) {
|
if (sizeof($_SERVER["argv"]) == 0) {
|
||||||
|
@ -55,12 +53,8 @@ require_once "boot.php";
|
||||||
require_once "include/dba.php";
|
require_once "include/dba.php";
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
BaseObject::setApp($a);
|
|
||||||
|
|
||||||
@include ".htconfig.php";
|
if ($a->mode === App::MODE_NORMAL) {
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
$oAuth = new ExAuth();
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
$oAuth->readStdin();
|
||||||
|
}
|
||||||
$oAuth = new ExAuth();
|
|
||||||
|
|
||||||
$oAuth->readStdin();
|
|
|
@ -8,7 +8,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseObject;
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Worker;
|
use Friendica\Core\Worker;
|
||||||
|
|
||||||
|
@ -28,18 +27,21 @@ require_once "boot.php";
|
||||||
require_once "include/dba.php";
|
require_once "include/dba.php";
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
BaseObject::setApp($a);
|
|
||||||
|
|
||||||
require_once ".htconfig.php";
|
if ($a->isInstallMode()) {
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
die("Friendica isn't properly installed yet.\n");
|
||||||
|
}
|
||||||
|
|
||||||
Config::load();
|
Config::load();
|
||||||
|
|
||||||
if (!isset($pidfile)) {
|
if (empty(Config::get('system', 'pidfile'))) {
|
||||||
die('Please specify a pid file in the variable $pidfile in the .htconfig.php. For example:'."\n".
|
die('Please set system.pidfile in config/local.ini.php. For example:'."\n".
|
||||||
'$pidfile = "/path/to/daemon.pid";'."\n");
|
'[system]'."\n".
|
||||||
|
'pidfile = /path/to/daemon.pid'."\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pidfile = Config::get('system', 'pidfile');
|
||||||
|
|
||||||
if (in_array("start", $_SERVER["argv"])) {
|
if (in_array("start", $_SERVER["argv"])) {
|
||||||
$mode = "start";
|
$mode = "start";
|
||||||
}
|
}
|
||||||
|
@ -127,11 +129,9 @@ if (!$foreground) {
|
||||||
file_put_contents($pidfile, $pid);
|
file_put_contents($pidfile, $pid);
|
||||||
|
|
||||||
// We lose the database connection upon forking
|
// We lose the database connection upon forking
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
$a->loadDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
Config::set('system', 'worker_daemon_mode', true);
|
Config::set('system', 'worker_daemon_mode', true);
|
||||||
|
|
||||||
// Just to be sure that this script really runs endlessly
|
// Just to be sure that this script really runs endlessly
|
||||||
|
|
|
@ -83,7 +83,7 @@ def fix_element(element):
|
||||||
element += ldelim + parts[first+1].rstrip('}') + rdelim
|
element += ldelim + parts[first+1].rstrip('}') + rdelim
|
||||||
else:
|
else:
|
||||||
# This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }}
|
# This takes care of elements where the filename is a path, e.g. {{ inc file.tpl }}
|
||||||
element += parts[first+1].rstrip('}')
|
element += parts[first+1].rstrip('}')
|
||||||
|
|
||||||
element += '"'
|
element += '"'
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ try:
|
||||||
except getopt.GetoptError:
|
except getopt.GetoptError:
|
||||||
help(sys.argv[0])
|
help(sys.argv[0])
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
|
|
||||||
|
|
||||||
if path == '':
|
if path == '':
|
||||||
path = raw_input('Path to template folder to convert: ')
|
path = raw_input('Path to template folder to convert: ')
|
||||||
|
@ -220,7 +220,7 @@ if not os.path.exists(outpath):
|
||||||
|
|
||||||
files = os.listdir(path)
|
files = os.listdir(path)
|
||||||
for a_file in files:
|
for a_file in files:
|
||||||
if a_file == 'htconfig.tpl':
|
if a_file == 'local.ini.tpl':
|
||||||
php_tpl = True
|
php_tpl = True
|
||||||
else:
|
else:
|
||||||
php_tpl = False
|
php_tpl = False
|
||||||
|
|
|
@ -24,14 +24,8 @@ if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once "boot.php";
|
require_once "boot.php";
|
||||||
require_once "include/dba.php";
|
|
||||||
|
|
||||||
$a = new App(dirname(__DIR__));
|
$a = new App(dirname(__DIR__));
|
||||||
BaseObject::setApp($a);
|
|
||||||
|
|
||||||
require_once ".htconfig.php";
|
|
||||||
dba::connect($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
Config::load();
|
Config::load();
|
||||||
|
|
||||||
|
|
46
boot.php
46
boot.php
|
@ -64,15 +64,13 @@ define('EOL', "<br />\r\n");
|
||||||
* @brief Image storage quality.
|
* @brief Image storage quality.
|
||||||
*
|
*
|
||||||
* Lower numbers save space at cost of image detail.
|
* Lower numbers save space at cost of image detail.
|
||||||
* For ease of upgrade, please do not change here. Change jpeg quality with
|
* For ease of upgrade, please do not change here. Set [system] jpegquality = n in config/local.ini.php,
|
||||||
* $a->config['system']['jpeg_quality'] = n;
|
* where n is between 1 and 100, and with very poor results below about 50
|
||||||
* in .htconfig.php, where n is netween 1 and 100, and with very poor results
|
|
||||||
* below about 50
|
|
||||||
*/
|
*/
|
||||||
define('JPEG_QUALITY', 100);
|
define('JPEG_QUALITY', 100);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* $a->config['system']['png_quality'] from 0 (uncompressed) to 9
|
* [system] png_quality = n where is between 0 (uncompressed) to 9
|
||||||
*/
|
*/
|
||||||
define('PNG_QUALITY', 8);
|
define('PNG_QUALITY', 8);
|
||||||
|
|
||||||
|
@ -83,9 +81,10 @@ define('PNG_QUALITY', 8);
|
||||||
* this length (on the longest side, the other side will be scaled appropriately).
|
* this length (on the longest side, the other side will be scaled appropriately).
|
||||||
* Modify this value using
|
* Modify this value using
|
||||||
*
|
*
|
||||||
* $a->config['system']['max_image_length'] = n;
|
* [system]
|
||||||
|
* max_image_length = n;
|
||||||
*
|
*
|
||||||
* in .htconfig.php
|
* in config/local.ini.php
|
||||||
*
|
*
|
||||||
* If you don't want to set a maximum length, set to -1. The default value is
|
* If you don't want to set a maximum length, set to -1. The default value is
|
||||||
* defined by 'MAX_IMAGE_LENGTH' below.
|
* defined by 'MAX_IMAGE_LENGTH' below.
|
||||||
|
@ -509,14 +508,7 @@ if (!defined('CURLE_OPERATION_TIMEDOUT')) {
|
||||||
*/
|
*/
|
||||||
function get_app()
|
function get_app()
|
||||||
{
|
{
|
||||||
global $a;
|
return BaseObject::getApp();
|
||||||
|
|
||||||
if (empty($a)) {
|
|
||||||
$a = new App(dirname(__DIR__));
|
|
||||||
BaseObject::setApp($a);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -782,7 +774,7 @@ function run_update_function($x)
|
||||||
/**
|
/**
|
||||||
* @brief Synchronise addons:
|
* @brief Synchronise addons:
|
||||||
*
|
*
|
||||||
* $a->config['system']['addon'] contains a comma-separated list of names
|
* system.addon contains a comma-separated list of names
|
||||||
* of addons which are used on this system.
|
* of addons which are used on this system.
|
||||||
* Go through the database list of already installed addons, and if we have
|
* Go through the database list of already installed addons, and if we have
|
||||||
* an entry, but it isn't in the config list, call the uninstall procedure
|
* an entry, but it isn't in the config list, call the uninstall procedure
|
||||||
|
@ -965,17 +957,6 @@ function info($s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Wrapper around config to limit the text length of an incoming message
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
function get_max_import_size()
|
|
||||||
{
|
|
||||||
$a = get_app();
|
|
||||||
return (x($a->config, 'max_import_size') ? $a->config['max_import_size'] : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
function feed_birthday($uid, $tz)
|
function feed_birthday($uid, $tz)
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -1031,14 +1012,11 @@ function is_site_admin()
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
|
$admin_email = Config::get('config', 'admin_email');
|
||||||
|
|
||||||
//if(local_user() && x($a->user,'email') && x($a->config,'admin_email') && ($a->user['email'] === $a->config['admin_email']))
|
$adminlist = explode(',', str_replace(' ', '', $admin_email));
|
||||||
/// @TODO This if() + 2 returns can be shrinked into one return
|
|
||||||
if (local_user() && x($a->user, 'email') && x($a->config, 'admin_email') && in_array($a->user['email'], $adminlist)) {
|
return local_user() && $admin_email && in_array(defaults($a->user, 'email', ''), $adminlist);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
"issues": "https://github.com/friendica/friendica/issues"
|
"issues": "https://github.com/friendica/friendica/issues"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">5.6",
|
"php": ">=5.6.1",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"asika/simple-console": "^1.0",
|
"asika/simple-console": "^1.0",
|
||||||
"divineomega/password_exposed": "^2.4",
|
"divineomega/password_exposed": "^2.4",
|
||||||
|
|
4
composer.lock
generated
4
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "4fcae78061a3eb72f91e4fa81e53af56",
|
"content-hash": "9e24971ae9340c5d9d4d4ca477d4ec29",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "asika/simple-console",
|
"name": "asika/simple-console",
|
||||||
|
@ -3582,7 +3582,7 @@
|
||||||
"prefer-stable": false,
|
"prefer-stable": false,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
"php": ">5.6",
|
"php": ">=5.6.1",
|
||||||
"ext-xml": "*"
|
"ext-xml": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": []
|
"platform-dev": []
|
||||||
|
|
10
config/addon-sample.ini.php
Normal file
10
config/addon-sample.ini.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php return <<<INI
|
||||||
|
|
||||||
|
; Copy this configuration file to addon.ini.php and edit it if you want to configure addons, see below example for the twitter addon
|
||||||
|
|
||||||
|
;[twitter]
|
||||||
|
;consumerkey = localhost
|
||||||
|
;consumersecret = mysqlusername
|
||||||
|
|
||||||
|
INI;
|
||||||
|
// Keep this line
|
408
config/config.ini.php
Normal file
408
config/config.ini.php
Normal file
|
@ -0,0 +1,408 @@
|
||||||
|
<?php return <<<INI
|
||||||
|
|
||||||
|
; CONFIG.INI.PHP
|
||||||
|
|
||||||
|
; This file declares the default values for the base config of Friendica.
|
||||||
|
; These configuration values aren't accessible from the admin settings page and custom values must be set in config/loca.ini.php
|
||||||
|
|
||||||
|
; Please don't edit this file directly as its content may change in the upcoming versions.
|
||||||
|
|
||||||
|
[database]
|
||||||
|
|
||||||
|
; host (String)
|
||||||
|
; Hostname or IP address of the database server.
|
||||||
|
; Can contain the port number with the syntax "hostname:port".
|
||||||
|
hostname =
|
||||||
|
|
||||||
|
; user (String)
|
||||||
|
; Database user name. Please don't use "root".
|
||||||
|
username =
|
||||||
|
|
||||||
|
; pass (String)
|
||||||
|
; Database user password. Please don't use empty passwords.
|
||||||
|
password =
|
||||||
|
|
||||||
|
; base (String)
|
||||||
|
; Database name.
|
||||||
|
database =
|
||||||
|
|
||||||
|
; charset (String)
|
||||||
|
; Database connexion charset. Changing this value will likely corrupt special characters.
|
||||||
|
charset = utf8mb4
|
||||||
|
|
||||||
|
[config]
|
||||||
|
|
||||||
|
; admin_email (Comma-separated list)
|
||||||
|
; In order to perform system administration via the admin panel, this must precisely match the email address of the person logged in.
|
||||||
|
admin_email =
|
||||||
|
|
||||||
|
; admin_nickname (String)
|
||||||
|
; Nickname of the main admin user, used if there are more than one admin user defined in config.admin_email.
|
||||||
|
admin_nickname =
|
||||||
|
|
||||||
|
; max_import_size (Integer)
|
||||||
|
; Maximum body size of DFRN and Mail messages in characters. 0 is unlimited.
|
||||||
|
max_import_size = 200000
|
||||||
|
|
||||||
|
; php_path (String)
|
||||||
|
; Location of PHP command line processor.
|
||||||
|
php_path = php
|
||||||
|
|
||||||
|
[system]
|
||||||
|
|
||||||
|
; allowed_link_protocols (Array)
|
||||||
|
; Allowed protocols in links URLs, add at your own risk. http is always allowed.
|
||||||
|
allowed_link_protocols[0] = ftp
|
||||||
|
allowed_link_protocols[1] = ftps
|
||||||
|
allowed_link_protocols[2] = mailto
|
||||||
|
allowed_link_protocols[3] = cid
|
||||||
|
allowed_link_protocols[4] = gopher
|
||||||
|
|
||||||
|
; always_show_preview (Boolean)
|
||||||
|
; Only show small preview picures.
|
||||||
|
always_show_preview = false
|
||||||
|
|
||||||
|
; archival_days (Integer)
|
||||||
|
; Number of days that we try to deliver content before we archive a contact.
|
||||||
|
archival_days = 32
|
||||||
|
|
||||||
|
; auth_cookie_lifetime (Integer)
|
||||||
|
; Number of days that should pass without any activity before a user who chose "Remember me" when logging in is considered logged out.
|
||||||
|
auth_cookie_lifetime = 7
|
||||||
|
|
||||||
|
; block_local_dir (Boolean)
|
||||||
|
; Deny public access to the local user directory.
|
||||||
|
block_local_dir = false
|
||||||
|
|
||||||
|
; cache_driver (database|memcache|memcached|redis)
|
||||||
|
; Whether to use Memcache or Memcached or Redis to store temporary cache.
|
||||||
|
cache_driver = database
|
||||||
|
|
||||||
|
; config_adapter (jit|preload)
|
||||||
|
; Allow to switch the configuration adapter to improve performances at the cost of memory consumption.
|
||||||
|
config_adapter = jit
|
||||||
|
|
||||||
|
; curl_range_bytes (Integer)
|
||||||
|
; Maximum number of bytes that should be fetched. Default is 0, which mean "no limit".
|
||||||
|
curl_range_bytes = 0
|
||||||
|
|
||||||
|
; crawl_permit_period (Integer)
|
||||||
|
; Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated.
|
||||||
|
crawl_permit_period = 60
|
||||||
|
|
||||||
|
; db_log (Path)
|
||||||
|
; Name of a logfile to log slow database queries.
|
||||||
|
db_log =
|
||||||
|
|
||||||
|
; db_log_index (Path)
|
||||||
|
; Name of a logfile to log queries with bad indexes.
|
||||||
|
db_log_index =
|
||||||
|
|
||||||
|
; db_log_index_watch (Comma-separated list)
|
||||||
|
; Watchlist of indexes to watch.
|
||||||
|
db_log_index_watch =
|
||||||
|
|
||||||
|
; db_log_index_blacklist (Comma-separated list)
|
||||||
|
; Blacklist of indexes that shouldn't be watched.
|
||||||
|
db_log_index_blacklist =
|
||||||
|
|
||||||
|
; db_loglimit (Integer)
|
||||||
|
; If a database call lasts longer than this value in seconds it is logged.
|
||||||
|
; Inactive if system.db_log is empty.
|
||||||
|
db_loglimit = 10
|
||||||
|
|
||||||
|
; db_loglimit_index (Integer)
|
||||||
|
; Number of index rows needed to be logged for indexes on the watchlist. 0 to disable.
|
||||||
|
db_loglimit_index = 0
|
||||||
|
|
||||||
|
; db_loglimit_index_high (Integer)
|
||||||
|
; Number of index rows to be logged anyway (for any index). 0 to disable.
|
||||||
|
db_loglimit_index_high = 0
|
||||||
|
|
||||||
|
; dbclean_expire_conversation (Integer)
|
||||||
|
; When DBClean is enabled, any entry in the conversation table will be deleted after this many days.
|
||||||
|
; These data are normally needed only for debugging purposes and they are safe to delete.
|
||||||
|
dbclean_expire_conversation = 90
|
||||||
|
|
||||||
|
; diaspora_test (Boolean)
|
||||||
|
; For development only. Disables the message transfer.
|
||||||
|
diaspora_test = false
|
||||||
|
|
||||||
|
; disable_email_validation (Boolean)
|
||||||
|
; Disables the check if a mail address is in a valid format and can be resolved via DNS.
|
||||||
|
disable_email_validation = false
|
||||||
|
|
||||||
|
; disable_url_validation (Boolean)
|
||||||
|
; Disables the DNS lookup of an URL.
|
||||||
|
disable_url_validation = false
|
||||||
|
|
||||||
|
; disable_password_exposed (Boolean)
|
||||||
|
; Disable the exposition check against the remote haveibeenpwned API on password change.
|
||||||
|
disable_password_exposed = false
|
||||||
|
|
||||||
|
; dlogfile (Path)
|
||||||
|
; location of the developer log file.
|
||||||
|
dlogfile =
|
||||||
|
|
||||||
|
; dlogip (String)
|
||||||
|
; restricts develop log writes to requests originating from this IP address.
|
||||||
|
dlogip =
|
||||||
|
|
||||||
|
; free_crawls (Integer)
|
||||||
|
; Number of "free" searches when system.permit_crawling is activated.
|
||||||
|
free_crawls = 10
|
||||||
|
|
||||||
|
; frontend_worker_timeout (Integer)
|
||||||
|
; Value in minutes after we think that a frontend task was killed by the webserver.
|
||||||
|
frontend_worker_timeout = 10
|
||||||
|
|
||||||
|
; groupedit_image_limit (Integer)
|
||||||
|
; Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names.
|
||||||
|
; This can alternatively be set on a per account basis in the pconfig table.
|
||||||
|
groupedit_image_limit = 400
|
||||||
|
|
||||||
|
; hsts (Boolean)
|
||||||
|
; Enables the sending of HTTP Strict Transport Security headers.
|
||||||
|
hsts = false
|
||||||
|
|
||||||
|
; ignore_cache (Boolean)
|
||||||
|
; For development only. Disables the item cache.
|
||||||
|
ignore_cache = false
|
||||||
|
|
||||||
|
; instances_social_key (String)
|
||||||
|
; Key to the API of https://instances.social which retrieves data about mastodon servers.
|
||||||
|
; See https://instances.social/api/token to get an API key.
|
||||||
|
instances_social_key =
|
||||||
|
|
||||||
|
; ipv4_resolve (Boolean)
|
||||||
|
; Resolve IPV4 addresses only. Don't resolve to IPV6.
|
||||||
|
ipv4_resolve = false
|
||||||
|
|
||||||
|
; invitation_only (Boolean)
|
||||||
|
; If set true registration is only possible after a current member of the node has send an invitation.
|
||||||
|
invitation_only = false
|
||||||
|
|
||||||
|
; like_no_comment (Boolean)
|
||||||
|
; Don't update the "commented" value of an item when it is liked.
|
||||||
|
like_no_comment = false
|
||||||
|
|
||||||
|
; local_block (Boolean)
|
||||||
|
; Used in conjunction with "block_public".
|
||||||
|
local_block = false
|
||||||
|
|
||||||
|
; local_search (Boolean)
|
||||||
|
; Blocks search for users who are not logged in to prevent crawlers from blocking your system.
|
||||||
|
local_search = false
|
||||||
|
|
||||||
|
; local_tags (Boolean)
|
||||||
|
; If activated, all hashtags will point to the local server.
|
||||||
|
local_tags = false
|
||||||
|
|
||||||
|
; max_batch_queue (Integer)
|
||||||
|
; Maximum number of batched queue items for a single contact before subsequent messages are discarded.
|
||||||
|
max_batch_queue = 1000
|
||||||
|
|
||||||
|
; max_connections (Integer)
|
||||||
|
; The maximum number of database connections which can be in use before the worker process is deferred to its next interval.
|
||||||
|
; When the system can't detect the maximum numbers of connection then this value can be used. Use 0 for auto-detection.
|
||||||
|
max_connections = 0
|
||||||
|
|
||||||
|
; max_connections_level (Integer 0-100)
|
||||||
|
; The maximum percentage of connections that are allowed to let the worker start.
|
||||||
|
max_connections_level = 75
|
||||||
|
|
||||||
|
; max_contact_queue (Integer)
|
||||||
|
; Maximum number of queue items for a single contact before subsequent messages are discarded.
|
||||||
|
max_contact_queue = 500
|
||||||
|
|
||||||
|
; max_image_length (Integer)
|
||||||
|
; An alternate way of limiting picture upload sizes.
|
||||||
|
; Specify the maximum pixel length that pictures are allowed to be (for non-square pictures, it will apply to the longest side).
|
||||||
|
; Pictures longer than this length will be resized to be this length (on the longest side, the other side will be scaled appropriately).
|
||||||
|
; If you don't want to set a maximum length, set to -1.
|
||||||
|
max_image_length = -1
|
||||||
|
|
||||||
|
; max_processes_backend (Integer)
|
||||||
|
; Maximum number of concurrent database processes for background tasks.
|
||||||
|
max_processes_backend = 5
|
||||||
|
|
||||||
|
; max_processes_frontend (Integer)
|
||||||
|
; Maximum number of concurrent database processes for foreground tasks.
|
||||||
|
max_processes_frontend = 20
|
||||||
|
|
||||||
|
; maximagesize (Integer)
|
||||||
|
; Maximum size in bytes of an uploaded photo.
|
||||||
|
maximagesize = 800000
|
||||||
|
|
||||||
|
; memcache_host (String)
|
||||||
|
; Host name of the memcache daemon.
|
||||||
|
memcache_host = 127.0.0.1
|
||||||
|
|
||||||
|
; memcache_port (Integer)
|
||||||
|
; Port number of the memcache daemon.
|
||||||
|
memcache_port = 11211
|
||||||
|
|
||||||
|
; memcached_hosts (Array)
|
||||||
|
; Array of Memcached servers info "host, port(, weight)".
|
||||||
|
memcached_hosts[0] = 127.0.0.1,11211
|
||||||
|
|
||||||
|
; min_poll_interval (Integer)
|
||||||
|
; minimal distance in minutes between two polls for a contact. Reasonable values are between 1 and 59.
|
||||||
|
min_poll_interval = 1
|
||||||
|
|
||||||
|
; no_count (Boolean)
|
||||||
|
; Don't do count calculations (currently only when showing albums).
|
||||||
|
no_count = false
|
||||||
|
|
||||||
|
; no_oembed (Boolean)
|
||||||
|
; Don't use OEmbed to fetch more information about a link.
|
||||||
|
no_oembed = false
|
||||||
|
|
||||||
|
; no_smilies (Boolean)
|
||||||
|
; Don't show smilies.
|
||||||
|
no_smilies = false
|
||||||
|
|
||||||
|
; no_view_full_size (Boolean)
|
||||||
|
; Don't add the link "View full size" under a resized image.
|
||||||
|
no_view_full_size = false
|
||||||
|
|
||||||
|
; optimize_items (Boolean)
|
||||||
|
; Triggers an SQL command to optimize the item table before expiring items.
|
||||||
|
optimize_items = false
|
||||||
|
|
||||||
|
; paranoia (Boolean)
|
||||||
|
; Log out users if their IP address changed.
|
||||||
|
paranoia = false
|
||||||
|
|
||||||
|
; permit_crawling (Boolean)
|
||||||
|
; Restricts the search for not logged in users to one search per minute.
|
||||||
|
permit_crawling = false
|
||||||
|
|
||||||
|
; pidfile (Path)
|
||||||
|
; Daemon pid file path. For example: pidfile = /path/to/daemon.pid
|
||||||
|
pidfile =
|
||||||
|
|
||||||
|
; png_quality (Integer)
|
||||||
|
; Sets the ImageMagick compression level for PNG images. Values ranges from 0 (uncompressed) to 9 (most compressed).
|
||||||
|
png_quality = 8
|
||||||
|
|
||||||
|
; profiler (Boolean)
|
||||||
|
; Enable internal timings to help optimize code. Needed for "rendertime" addon.
|
||||||
|
profiler = false
|
||||||
|
|
||||||
|
; proxy_cache_time (Integer)
|
||||||
|
; Period in seconds after which the cache is cleared.
|
||||||
|
proxy_cache_time = 86400
|
||||||
|
|
||||||
|
; pushpoll_frequency (Integer)
|
||||||
|
; Frequency of contact poll for subhub contact using the DFRM or OStatus network.
|
||||||
|
; Available values:
|
||||||
|
; - 5 = every month
|
||||||
|
; - 4 = every week
|
||||||
|
; - 3 = every day
|
||||||
|
; - 2 = twice a day
|
||||||
|
; - 1 = every hour
|
||||||
|
; - 0 = every minute
|
||||||
|
pushpoll_frequency = 3
|
||||||
|
|
||||||
|
; queue_no_dead_check (Boolean)
|
||||||
|
; Ignore if the target contact or server seems to be dead during queue delivery.
|
||||||
|
queue_no_dead_check = false
|
||||||
|
|
||||||
|
; redis_host (String)
|
||||||
|
; Host name of the redis daemon.
|
||||||
|
redis_host = 127.0.0.1
|
||||||
|
|
||||||
|
; redis_port (String)
|
||||||
|
; Port number of the redis daemon.
|
||||||
|
redis_port = 6379
|
||||||
|
|
||||||
|
; session_handler (database|cache|native)
|
||||||
|
; Whether to use Cache to store session data or to use PHP native session storage.
|
||||||
|
session_handler = database
|
||||||
|
|
||||||
|
; remove_multiplicated_lines (Boolean)
|
||||||
|
; If enabled, multiple linefeeds in items are stripped to a single one.
|
||||||
|
remove_multiplicated_lines = false
|
||||||
|
|
||||||
|
; sendmail_params (Boolean)
|
||||||
|
; Normal sendmail command parameters will be added when the PHP mail() function is called for sending e-mails.
|
||||||
|
; This ensures the Sender Email address setting is applied to the message envelope rather than the host's default address.
|
||||||
|
; Set to false if your non-sendmail agent is incompatible, or to restore old behavior of using the host address.
|
||||||
|
sendmail_params = true
|
||||||
|
|
||||||
|
; show_global_community_hint (Boolean)
|
||||||
|
; When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive on your node.
|
||||||
|
show_global_community_hint = false
|
||||||
|
|
||||||
|
; show_unsupported_addons (Boolean)
|
||||||
|
; Show all addons including the unsupported ones.
|
||||||
|
show_unsupported_addons = false
|
||||||
|
|
||||||
|
; show_unsupported_themes (Boolean)
|
||||||
|
; Show all themes including the unsupported ones.
|
||||||
|
show_unsupported_themes = false
|
||||||
|
|
||||||
|
; throttle_limit_day (Integer)
|
||||||
|
; Maximum number of posts that a user can send per day with the API. 0 to disable daily throttling.
|
||||||
|
throttle_limit_day = 0
|
||||||
|
|
||||||
|
; throttle_limit_week (Integer)
|
||||||
|
; Maximum number of posts that a user can send per week with the API. 0 to disable weekly throttling.
|
||||||
|
throttle_limit_week = 0
|
||||||
|
|
||||||
|
; throttle_limit_month (Integer)
|
||||||
|
; Maximum number of posts that a user can send per month with the API. 0 to disable monthly throttling.
|
||||||
|
throttle_limit_month = 0
|
||||||
|
|
||||||
|
; urlpath (String)
|
||||||
|
; If you are using a subdirectory of your domain you will need to put the relative path (from the root of your domain) here.
|
||||||
|
; For instance if your URL is 'http://example.com/directory/subdirectory', set urlpath to 'directory/subdirectory'.
|
||||||
|
urlpath =
|
||||||
|
|
||||||
|
; worker_cooldown (Integer)
|
||||||
|
; Cooldown period in seconds after each worker function call.
|
||||||
|
worker_cooldown = 0
|
||||||
|
|
||||||
|
; worker_debug (Boolean)
|
||||||
|
; If enabled, it prints out the number of running processes split by priority.
|
||||||
|
worker_debug = false
|
||||||
|
|
||||||
|
; worker_fetch_limit (Integer)
|
||||||
|
; Number of worker tasks that are fetched in a single query.
|
||||||
|
worker_fetch_limit = 1
|
||||||
|
|
||||||
|
; worker_load_exponent (Integer)
|
||||||
|
; Default 3, which allows only 25% of the maximum worker queues when server load reaches around 37% of maximum load.
|
||||||
|
; For a linear response where 25% of worker queues are allowed at 75% of maximum load, set this to 1.
|
||||||
|
; Setting 0 would allow maximum worker queues at all times, which is not recommended.
|
||||||
|
worker_load_exponent = 3
|
||||||
|
|
||||||
|
; xrd_timeout (Integer)
|
||||||
|
; Timeout in seconds for fetching the XRD links.
|
||||||
|
xrd_timeout = 20
|
||||||
|
|
||||||
|
[experimental]
|
||||||
|
|
||||||
|
; exp_themes (Boolean)
|
||||||
|
; Show experimental themes in user settings.
|
||||||
|
exp_themes = false
|
||||||
|
|
||||||
|
[theme]
|
||||||
|
|
||||||
|
; hide_eventlist (Boolean)
|
||||||
|
; Don't show the birthdays and events on the profile and network page.
|
||||||
|
hide_eventlist = false
|
||||||
|
|
||||||
|
[jabber]
|
||||||
|
|
||||||
|
; debug (Boolean)
|
||||||
|
; Enable debug level for the jabber account synchronisation.
|
||||||
|
debug = false
|
||||||
|
|
||||||
|
; lockpath (Path)
|
||||||
|
; Must be writable by the ejabberd process. if set then it will prevent the running of multiple processes.
|
||||||
|
lockpath =
|
||||||
|
|
||||||
|
INI;
|
||||||
|
// Keep this line
|
41
config/local-sample.ini.php
Normal file
41
config/local-sample.ini.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php return <<<INI
|
||||||
|
|
||||||
|
; If automatic system installation fails:
|
||||||
|
|
||||||
|
; Copy this file to local.ini.php
|
||||||
|
|
||||||
|
; Why local.ini.php? Because it contains sensitive information which could
|
||||||
|
; give somebody complete control of your database. Apache's default
|
||||||
|
; configuration will interpret any .php file as a script and won't show the values
|
||||||
|
|
||||||
|
; Then set the following for your MySQL installation
|
||||||
|
|
||||||
|
[database]
|
||||||
|
hostname = localhost
|
||||||
|
username = mysqlusername
|
||||||
|
password = mysqlpassword
|
||||||
|
database = mysqldatabasename
|
||||||
|
charset = utf8mb4
|
||||||
|
|
||||||
|
|
||||||
|
; ****************************************************************
|
||||||
|
; The configuration below will be overruled by the admin panel.
|
||||||
|
; Changes made below will only have an effect if the database does
|
||||||
|
; not contain any configuration for the friendica system.
|
||||||
|
; ****************************************************************
|
||||||
|
|
||||||
|
[config]
|
||||||
|
admin_email =
|
||||||
|
|
||||||
|
sitename = Friendica Social Network
|
||||||
|
|
||||||
|
register_policy = REGISTER_OPEN
|
||||||
|
register_text =
|
||||||
|
|
||||||
|
[system]
|
||||||
|
default_timezone = UTC
|
||||||
|
|
||||||
|
language = en
|
||||||
|
|
||||||
|
INI;
|
||||||
|
// Keep this line
|
108
config/settings.ini.php
Normal file
108
config/settings.ini.php
Normal file
|
@ -0,0 +1,108 @@
|
||||||
|
<?php return <<<INI
|
||||||
|
|
||||||
|
; SETTINGS.INI.PHP
|
||||||
|
|
||||||
|
; This file declares the default values for the admin settings of Friendica.
|
||||||
|
; These values will be overriden by the admin settings page.
|
||||||
|
|
||||||
|
; Please don't edit this file directly as its content may change in the upcoming versions.
|
||||||
|
|
||||||
|
[config]
|
||||||
|
|
||||||
|
; info (String)
|
||||||
|
; Plaintext description of this node, used in the /friendica module.
|
||||||
|
info =
|
||||||
|
|
||||||
|
; register_policy (Constant)
|
||||||
|
; Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
||||||
|
; Be certain to create your own personal account before setting REGISTER_CLOSED.
|
||||||
|
; REGISTER_APPROVE requires you set system.admin_email to the email address of an already registered person who can authorize and/or approve/deny the request.
|
||||||
|
register_policy = REGISTER_CLOSED
|
||||||
|
|
||||||
|
; register_text (String)
|
||||||
|
; Will be displayed prominently on the registration page.
|
||||||
|
register_text = ''
|
||||||
|
|
||||||
|
; sitename (String)
|
||||||
|
; Displayed server name.
|
||||||
|
sitename = "Friendica Social Network"
|
||||||
|
|
||||||
|
[system]
|
||||||
|
|
||||||
|
; account_abandon_days (Integer)
|
||||||
|
; Will not waste system resources polling external sites for abandonded accounts.
|
||||||
|
; Enter 0 for no time limit.
|
||||||
|
account_abandon_days = 0
|
||||||
|
|
||||||
|
; addon (Comma-separated list)
|
||||||
|
; Manual list of addons which are enabled on this system.
|
||||||
|
addon =
|
||||||
|
|
||||||
|
; allowed_themes (Comma-separated list)
|
||||||
|
; Themes users can change to in their settings.
|
||||||
|
allowed_themes = 'quattro,vier,duepuntozero,smoothly'
|
||||||
|
|
||||||
|
; default_timezone (String)
|
||||||
|
; Choose a default timezone. See https://secure.php.net/manual/en/timezones.php
|
||||||
|
; It only applies to timestamps for anonymous viewers.
|
||||||
|
default_timezone = UTC
|
||||||
|
|
||||||
|
; directory (String)
|
||||||
|
; URL of the global directory.
|
||||||
|
directory = https://dir.friendi.social
|
||||||
|
|
||||||
|
; forbidden_nicknames (Comma-separated list)
|
||||||
|
; Prevents users from registering the specified nicknames on this node.
|
||||||
|
; Default value comprises classic role names from RFC 2142.
|
||||||
|
forbidden_nicknames = info, marketing, sales, support, abuse, noc, security, postmaster, hostmaster, usenet, news, webmaster, www, uucp, ftp, root, sysop
|
||||||
|
|
||||||
|
; jpeg_quality (Integer)
|
||||||
|
; Sets the ImageMagick quality level for JPEG images. Values ranges from 50 (awful) to 100 (near perfect).
|
||||||
|
jpeg_quality = 100
|
||||||
|
|
||||||
|
; language (String)
|
||||||
|
; System default languague, inluding admin-created user default language.
|
||||||
|
; Two-letters ISO 639-1 code.
|
||||||
|
language = en
|
||||||
|
|
||||||
|
; max_image_length (Integer)
|
||||||
|
; An alternate way of limiting picture upload sizes.
|
||||||
|
; Specify the maximum pixel length that pictures are allowed to be (for non-square pictures, it will apply to the longest side).
|
||||||
|
; Pictures longer than this length will be resized to be this length (on the longest side, the other side will be scaled appropriately).
|
||||||
|
; If you don't want to set a maximum length, set to -1.
|
||||||
|
max_image_length = -1
|
||||||
|
|
||||||
|
; maximagesize (Integer)
|
||||||
|
; Maximum size in bytes of an uploaded photo.
|
||||||
|
maximagesize = 800000
|
||||||
|
|
||||||
|
; no_regfullname (Boolean)
|
||||||
|
; Allow pseudonyms (true) or enforce a space between firstname and lastname in Full name, as an antispam measure (false).
|
||||||
|
no_regfullname = true
|
||||||
|
|
||||||
|
; optimize_max_tablesize (Integer)
|
||||||
|
; Maximum table size (in MB) for the automatic optimization.
|
||||||
|
; -1 to disable automatic optimization.
|
||||||
|
; 0 to use internal default (100MB)
|
||||||
|
optimize_max_tablesize = -1
|
||||||
|
|
||||||
|
; rino_encrypt (Integer)
|
||||||
|
; Server-to-server private message encryption (RINO).
|
||||||
|
; Encryption will only be provided if this setting is set to a non zero value on both servers.
|
||||||
|
; Set to 0 to disable, 2 to enable, 1 is deprecated but wont need mcrypt.
|
||||||
|
rino_encrypt = 2
|
||||||
|
|
||||||
|
; theme (String)
|
||||||
|
; System theme name.
|
||||||
|
theme = vier
|
||||||
|
|
||||||
|
; url (String)
|
||||||
|
; The fully-qualified URL of this Friendica node.
|
||||||
|
; Used by the worker in a non-HTTP execution environment.
|
||||||
|
url =
|
||||||
|
|
||||||
|
; Used in the admin settings to lock certain features
|
||||||
|
[featurelock]
|
||||||
|
|
||||||
|
INI;
|
||||||
|
// Keep this line
|
|
@ -323,6 +323,9 @@ Called before calling PHP's `mail()`.
|
||||||
- **body**
|
- **body**
|
||||||
- **headers**
|
- **headers**
|
||||||
|
|
||||||
|
### load_config
|
||||||
|
Called during `App` initialization to allow addons to load their own configuration file(s) with `App::loadConfigFile()`.
|
||||||
|
|
||||||
### nav_info
|
### nav_info
|
||||||
Called after the navigational menu is build in `include/nav.php`.
|
Called after the navigational menu is build in `include/nav.php`.
|
||||||
`$b` is an array containing `$nav` from `include/nav.php`.
|
`$b` is an array containing `$nav` from `include/nav.php`.
|
||||||
|
@ -565,6 +568,10 @@ Here is a complete list of all hook callbacks with file locations (as of 01-Apr-
|
||||||
|
|
||||||
Addon::callHooks("template_vars", $arr);
|
Addon::callHooks("template_vars", $arr);
|
||||||
|
|
||||||
|
### src/App.php
|
||||||
|
|
||||||
|
Addon::callHooks('load_config');
|
||||||
|
|
||||||
### src/Model/Item.php
|
### src/Model/Item.php
|
||||||
|
|
||||||
Addon::callHooks('post_local', $item);
|
Addon::callHooks('post_local', $item);
|
||||||
|
|
230
doc/Config.md
Normal file
230
doc/Config.md
Normal file
|
@ -0,0 +1,230 @@
|
||||||
|
Config values that can only be set in config/local.ini.php
|
||||||
|
==========================================================
|
||||||
|
|
||||||
|
* [Home](help)
|
||||||
|
|
||||||
|
Friendica's configuration is done in two places: in INI configuration files and in the `config` database table.
|
||||||
|
Database config values overwrite the same file config values.
|
||||||
|
|
||||||
|
## File configuration
|
||||||
|
|
||||||
|
The configuration format for file configuration is an INI string returned from a PHP file.
|
||||||
|
This prevents your webserver from displaying your private configuration it interprets the configuration files and displays nothing.
|
||||||
|
|
||||||
|
A typical configuration file looks like this:
|
||||||
|
|
||||||
|
```php
|
||||||
|
<?php return <<<INI
|
||||||
|
|
||||||
|
; Comment line
|
||||||
|
|
||||||
|
[section1]
|
||||||
|
key = value
|
||||||
|
empty_key =
|
||||||
|
|
||||||
|
[section2]
|
||||||
|
array[] = value0
|
||||||
|
array[] = value1
|
||||||
|
array[] = value2
|
||||||
|
|
||||||
|
INI;
|
||||||
|
// Keep this line
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuration location
|
||||||
|
|
||||||
|
The `config` directory holds key configuration files:
|
||||||
|
|
||||||
|
- `config.ini.php` holds the default values for all the configuration keys that can only be set in `local.ini.php`.
|
||||||
|
- `settings.ini.php` holds the default values for some configuration keys that are set through the admin settings page.
|
||||||
|
- `local.ini.php` holds the current node custom configuration.
|
||||||
|
- `addon.ini.php` is optional and holds the custom configuration for specific addons.
|
||||||
|
|
||||||
|
Addons can define their own default configuration values in `addon/[addon]/config/[addon].ini.php` which is loaded when the addon is activated.
|
||||||
|
|
||||||
|
#### Migrating from .htconfig.php to config/local.ini.php
|
||||||
|
|
||||||
|
The legacy `.htconfig.php` configuration file is still supported, but is deprecated and will be removed in a subsequent Friendica release.
|
||||||
|
|
||||||
|
The migration is pretty straightforward:
|
||||||
|
If you had any addon-specific configuration in your `.htconfig.php`, just copy `config/addon-sample.ini.php` to `config/addon.ini.php` and move your configuration values.
|
||||||
|
Afterwards, copy `config/local-sample.ini.php` to `config/local.ini.php`, move the remaining configuration values to it according to the following conversion chart, then rename your `.htconfig.php` to check your node is working as expected before deleting it.
|
||||||
|
|
||||||
|
<style>
|
||||||
|
table.config {
|
||||||
|
margin: 1em 0;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
border-collapse: collapse;
|
||||||
|
color: #000;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.config > tr > th,
|
||||||
|
table.config > tr > td,
|
||||||
|
table.config > * > tr > th,
|
||||||
|
table.config > * > tr > td {
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
padding: 0.2em 0.4em
|
||||||
|
}
|
||||||
|
|
||||||
|
table.config > tr > th,
|
||||||
|
table.config > * > tr > th {
|
||||||
|
background-color: #f2f2f2;
|
||||||
|
text-align: center;
|
||||||
|
width: 50%
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<table class="config">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>.htconfig.php</th>
|
||||||
|
<th>config/local.ini.php</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$db_host = 'localhost';
|
||||||
|
$db_user = 'mysqlusername';
|
||||||
|
$db_pass = 'mysqlpassword';
|
||||||
|
$db_data = 'mysqldatabasename';
|
||||||
|
$a->config["system"]["db_charset"] = 'utf8mb4';
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[database]
|
||||||
|
hostname = localhost
|
||||||
|
username = mysqlusername
|
||||||
|
password = mysqlpassword
|
||||||
|
database = mysqldatabasename
|
||||||
|
charset = utf8mb4
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$a->config["section"]["key"] = "value";
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[section]
|
||||||
|
key = value
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$a->config["section"]["key"] = array(
|
||||||
|
"value1",
|
||||||
|
"value2",
|
||||||
|
"value3"
|
||||||
|
);
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[section]
|
||||||
|
key[] = value1
|
||||||
|
key[] = value2
|
||||||
|
key[] = value3
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$a->config["key"] = "value";
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[config]
|
||||||
|
key = value
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$a->path = "value";
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[system]
|
||||||
|
urlpath = value
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$default_timezone = "value";
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[system]
|
||||||
|
default_timezone = value
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$pidfile = "value";
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[system]
|
||||||
|
pidfile = value
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td><pre>
|
||||||
|
$lang = "value";
|
||||||
|
</pre></td>
|
||||||
|
<td><pre>
|
||||||
|
[system]
|
||||||
|
language = value
|
||||||
|
</pre></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
### Database Settings
|
||||||
|
|
||||||
|
The configuration variables database.hostname, database.username, database.password, database.database and database.charset are holding your credentials for the database connection.
|
||||||
|
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the database.hostname variable.
|
||||||
|
|
||||||
|
[database]
|
||||||
|
hostname = your.mysqlhost.com:123456
|
||||||
|
|
||||||
|
If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
|
||||||
|
|
||||||
|
MYSQL_HOST
|
||||||
|
MYSQL_PORT
|
||||||
|
MYSQL_USERNAME
|
||||||
|
MYSQL_PASSWORD
|
||||||
|
MYSQL_DATABASE
|
||||||
|
|
||||||
|
## Config values that can only be set in config/local.ini.php
|
||||||
|
|
||||||
|
There are some config values that haven't found their way into the administration page.
|
||||||
|
This has several reasons.
|
||||||
|
Maybe they are part of a current development that isn't considered stable and will be added later in the administration page when it is considered safe.
|
||||||
|
Or it triggers something that isn't expected to be of public interest.
|
||||||
|
Or it is for testing purposes only.
|
||||||
|
|
||||||
|
**Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger.
|
||||||
|
Especially don't do that with undocumented values.
|
||||||
|
|
||||||
|
These configurations keys and their default value are listed in `config/config.ini.php` and should be ovewritten in `config/local.ini.php`.
|
||||||
|
|
||||||
|
## Administrator Options
|
||||||
|
|
||||||
|
Enabling the admin panel for an account, and thus making the account holder admin of the node, is done by setting the variable
|
||||||
|
|
||||||
|
[config]
|
||||||
|
admin_email = someone@example.com
|
||||||
|
|
||||||
|
Where you have to match the email address used for the account with the one you enter to the config/local.ini.php file.
|
||||||
|
If more then one account should be able to access the admin panel, separate the email addresses with a comma.
|
||||||
|
|
||||||
|
[config]
|
||||||
|
admin_email = someone@example.com,someoneelse@example.com
|
||||||
|
|
||||||
|
If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name.
|
||||||
|
|
||||||
|
[config]
|
||||||
|
admin_name = Marvin
|
|
@ -197,14 +197,14 @@ If you are searching for new themes, you can find them at [Friendica-Themes.com]
|
||||||
<a name="adminaccount1"></a>
|
<a name="adminaccount1"></a>
|
||||||
### I've changed my email address now the admin panel is gone?
|
### I've changed my email address now the admin panel is gone?
|
||||||
|
|
||||||
Have a look into your <tt>.htconfig.php</tt> and fix your email address there.
|
Have a look into your <tt>config/local.ini.php</tt> and fix your email address there.
|
||||||
|
|
||||||
<a name="adminaccount2"></a>
|
<a name="adminaccount2"></a>
|
||||||
### Can there be more then one admin for a node?
|
### Can there be more then one admin for a node?
|
||||||
|
|
||||||
Yes.
|
Yes.
|
||||||
You just have to list more then one email address in the
|
You just have to list more then one email address in the
|
||||||
<tt>.htconfig.php</tt> file.
|
<tt>config/local.ini.php</tt> file.
|
||||||
The listed emails need to be separated by a comma.
|
The listed emails need to be separated by a comma.
|
||||||
|
|
||||||
<a name="dbupdate">
|
<a name="dbupdate">
|
||||||
|
|
|
@ -32,7 +32,7 @@ Friendica Documentation and Resources
|
||||||
* [Installing Connectors (Twitter/GNU Social)](help/Installing-Connectors)
|
* [Installing Connectors (Twitter/GNU Social)](help/Installing-Connectors)
|
||||||
* [Install an ejabberd server (XMPP chat) with synchronized credentials](help/install-ejabberd)
|
* [Install an ejabberd server (XMPP chat) with synchronized credentials](help/install-ejabberd)
|
||||||
* [Using SSL with Friendica](help/SSL)
|
* [Using SSL with Friendica](help/SSL)
|
||||||
* [Config values that can only be set in .htconfig.php](help/htconfig)
|
* [Config values that can only be set in config/local.ini.php](help/Config)
|
||||||
* [Improve Performance](help/Improve-Performance)
|
* [Improve Performance](help/Improve-Performance)
|
||||||
* [Administration Tools](help/tools)
|
* [Administration Tools](help/tools)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ Requirements
|
||||||
---
|
---
|
||||||
|
|
||||||
* Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file
|
* Apache with mod-rewrite enabled and "Options All" so you can use a local .htaccess file
|
||||||
* PHP 5.6+ (PHP 7 is recommended for performance)
|
* PHP 5.6.1+ (PHP 7 is recommended for performance)
|
||||||
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
* PHP *command line* access with register_argc_argv set to true in the php.ini file
|
||||||
* Curl, GD, PDO, MySQLi, hash, xml, zip and OpenSSL extensions
|
* Curl, GD, PDO, MySQLi, hash, xml, zip and OpenSSL extensions
|
||||||
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
* The POSIX module of PHP needs to be activated (e.g. [RHEL, CentOS](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) have disabled it)
|
||||||
|
@ -100,19 +100,20 @@ If you need to specify a port for the connection to the database, you can do so
|
||||||
|
|
||||||
*If* the manual installation fails for any reason, check the following:
|
*If* the manual installation fails for any reason, check the following:
|
||||||
|
|
||||||
* Does ".htconfig.php" exist? If not, edit htconfig.php and change the system settings. Rename to .htconfig.php
|
* Does "config/local.ini.php" exist? If not, edit config/local-sample.ini.php and change the system settings.
|
||||||
* Is the database is populated? If not, import the contents of "database.sql" with phpmyadmin or the mysql command line.
|
* Rename to `config/local.ini.php`.
|
||||||
|
* Is the database is populated? If not, import the contents of `database.sql` with phpmyadmin or the mysql command line.
|
||||||
|
|
||||||
At this point visit your website again, and register your personal account.
|
At this point visit your website again, and register your personal account.
|
||||||
Registration errors should all be recoverable automatically.
|
Registration errors should all be recoverable automatically.
|
||||||
If you get any *critical* failure at this point, it generally indicates the database was not installed correctly.
|
If you get any *critical* failure at this point, it generally indicates the database was not installed correctly.
|
||||||
You might wish to move/rename .htconfig.php to another name and empty (called 'dropping') the database tables, so that you can start fresh.
|
You might wish to move/rename `config/local.ini.php` to another name and empty (called 'dropping') the database tables, so that you can start fresh.
|
||||||
|
|
||||||
### Option B: Run the automatic install script
|
### Option B: Run the automatic install script
|
||||||
|
|
||||||
Open the file htconfig.php in the main Friendica directory with a text editor.
|
Open the file htconfig.php in the main Friendica directory with a text editor.
|
||||||
Remove the `die('...');` line and edit the lines to suit your installation (MySQL, language, theme etc.).
|
Remove the `die('...');` line and edit the lines to suit your installation (MySQL, language, theme etc.).
|
||||||
Then save the file (do not rename it).
|
Then save the file (do not rename it).
|
||||||
|
|
||||||
Navigate to the main Friendica directory and execute the following command:
|
Navigate to the main Friendica directory and execute the following command:
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ At this point visit your website again, and register your personal account.
|
||||||
|
|
||||||
*If* the automatic installation fails for any reason, check the following:
|
*If* the automatic installation fails for any reason, check the following:
|
||||||
|
|
||||||
* Does ".htconfig.php" already exist? If yes, the automatic installation won't start
|
* Does "config/local.ini.php" already exist? If yes, the automatic installation won't start
|
||||||
* Are the settings inside "htconfig.php" correct? If not, edit the file again.
|
* Are the settings inside "htconfig.php" correct? If not, edit the file again.
|
||||||
* Is the empty MySQL-database created? If not, create it.
|
* Is the empty MySQL-database created? If not, create it.
|
||||||
|
|
||||||
|
@ -162,5 +163,5 @@ Bad things will happen.
|
||||||
Let there be a hardware failure, a corrupted database or whatever you can think of.
|
Let there be a hardware failure, a corrupted database or whatever you can think of.
|
||||||
So once the installation of your Friendica node is done, you should make yourself a backup plan.
|
So once the installation of your Friendica node is done, you should make yourself a backup plan.
|
||||||
|
|
||||||
The most important file is the `.htconfig.php` file in the base directory.
|
The most important file is the `config/local.ini.php` file.
|
||||||
As it stores all your data, you should also have a recent dump of your Friendica database at hand, should you have to recover your node.
|
As it stores all your data, you should also have a recent dump of your Friendica database at hand, should you have to recover your node.
|
||||||
|
|
|
@ -4,7 +4,7 @@ Installing Connectors (Twitter/GNU Social)
|
||||||
* [Home](help)
|
* [Home](help)
|
||||||
|
|
||||||
|
|
||||||
Friendica uses addons to provide connectivity to some networks, such as Twitter or App.net.
|
Friendica uses addons to provide connectivity to some networks, such as Twitter.
|
||||||
|
|
||||||
There is also a addon to post through to an existing account on a GNU Social service.
|
There is also a addon to post through to an existing account on a GNU Social service.
|
||||||
You only need this to post to an already existing GNU Social account, but not to communicate with GNU Social members in general.
|
You only need this to post to an already existing GNU Social account, but not to communicate with GNU Social members in general.
|
||||||
|
@ -19,7 +19,7 @@ Addons must be installed by the site administrator before they can be used.
|
||||||
This is accomplished through the site administration panel.
|
This is accomplished through the site administration panel.
|
||||||
|
|
||||||
Each of the connectors also requires an "API key" from the service you wish to connect with.
|
Each of the connectors also requires an "API key" from the service you wish to connect with.
|
||||||
Some addons allow you to enter this information in the site administration pages, while others may require you to edit your configuration file (.htconfig.php).
|
Some addons allow you to enter this information in the site administration pages, while others may require you to edit your configuration file (config/local.ini.php).
|
||||||
The ways to obtain these keys vary between the services, but they all require an existing account on the target service.
|
The ways to obtain these keys vary between the services, but they all require an existing account on the target service.
|
||||||
Once installed, these API keys can usually be shared by all site members.
|
Once installed, these API keys can usually be shared by all site members.
|
||||||
|
|
||||||
|
@ -39,10 +39,11 @@ You can get it from [Twitter](https://twitter.com/apps).
|
||||||
Register your Friendica site as "Client" application with "Read & Write" access.
|
Register your Friendica site as "Client" application with "Read & Write" access.
|
||||||
We do not need "Twitter as login".
|
We do not need "Twitter as login".
|
||||||
When you've registered the app you get a key pair with an OAuth Consumer key and a secret key for your application/site.
|
When you've registered the app you get a key pair with an OAuth Consumer key and a secret key for your application/site.
|
||||||
Add this key pair to your global .htconfig.php:
|
Add this key pair to your config/local.ini.php:
|
||||||
|
|
||||||
$a->config['twitter']['consumerkey'] = 'your consumer_key here';
|
[twitter]
|
||||||
$a->config['twitter']['consumersecret'] = 'your consumer_secret here';
|
consumerkey = your consumer_key here
|
||||||
|
consumersecret = your consumer_secret here
|
||||||
|
|
||||||
After this, your users can configure their Twitter account settings from "Settings -> Connector Settings".
|
After this, your users can configure their Twitter account settings from "Settings -> Connector Settings".
|
||||||
|
|
||||||
|
@ -67,8 +68,8 @@ When the addon is activated the user has to acquire the following in order to co
|
||||||
|
|
||||||
To get the OAuth Consumer key pair the user has to
|
To get the OAuth Consumer key pair the user has to
|
||||||
|
|
||||||
1 ask her Friendica admin if a pair already exists or
|
1 ask her Friendica admin if a pair already exists or
|
||||||
2 has to register the Friendica server as a client application on the GNU Social server.
|
2 has to register the Friendica server as a client application on the GNU Social server.
|
||||||
|
|
||||||
This can be done from the account settings under "Settings -> Connections -> Register an OAuth client application -> Register a new application" on the GNU Social server.
|
This can be done from the account settings under "Settings -> Connections -> Register an OAuth client application -> Register a new application" on the GNU Social server.
|
||||||
|
|
||||||
|
@ -83,6 +84,6 @@ During the registration of the OAuth client remember the following:
|
||||||
After the required credentials for the application are stored in the configuration you have to actually connect your Friendica account with GNU Social.
|
After the required credentials for the application are stored in the configuration you have to actually connect your Friendica account with GNU Social.
|
||||||
This is done from the Settings -> Connector Settings page.
|
This is done from the Settings -> Connector Settings page.
|
||||||
Follow the Sign in with GNU Social button, allow access and then copy the security code into the box provided.
|
Follow the Sign in with GNU Social button, allow access and then copy the security code into the box provided.
|
||||||
Friendica will then try to acquire the final OAuth credentials from the API.
|
Friendica will then try to acquire the final OAuth credentials from the API.
|
||||||
|
|
||||||
If successful, the addon settings will allow you to select to post your public messages to your GNU Social account (have a look behind the little lock symbol beneath the status "editor" on your Home or Network pages).
|
If successful, the addon settings will allow you to select to post your public messages to your GNU Social account (have a look behind the little lock symbol beneath the status "editor" on your Home or Network pages).
|
||||||
|
|
|
@ -69,7 +69,7 @@ You can chose between the following modes:
|
||||||
##### Invitation based registry
|
##### Invitation based registry
|
||||||
|
|
||||||
Additionally to the setting in the admin panel, you can devide if registrations are only possible using an invitation code or not.
|
Additionally to the setting in the admin panel, you can devide if registrations are only possible using an invitation code or not.
|
||||||
To enable invitation based registration, you have to set the `invitation_only` setting in the [.htconfig.php](/help/htconfig) file.
|
To enable invitation based registration, you have to set the `invitation_only` setting in the [config/local.ini.php](/help/Config) file.
|
||||||
If you want to use this method, the registration policy has to be set to either *open* or *requires approval*.
|
If you want to use this method, the registration policy has to be set to either *open* or *requires approval*.
|
||||||
|
|
||||||
#### Check Full Names
|
#### Check Full Names
|
||||||
|
@ -325,7 +325,7 @@ You should set up some kind of [log rotation](https://en.wikipedia.org/wiki/Log_
|
||||||
**Known Issues**: The filename ``friendica.log`` can cause problems depending on your server configuration (see [issue 2209](https://github.com/friendica/friendica/issues/2209)).
|
**Known Issues**: The filename ``friendica.log`` can cause problems depending on your server configuration (see [issue 2209](https://github.com/friendica/friendica/issues/2209)).
|
||||||
|
|
||||||
By default PHP warnings and error messages are supressed.
|
By default PHP warnings and error messages are supressed.
|
||||||
If you want to enable those, you have to activate them in the ``.htconfig.php`` file.
|
If you want to enable those, you have to activate them in the ``config/local.ini.php`` file.
|
||||||
Use the following settings to redirect PHP errors to a file.
|
Use the following settings to redirect PHP errors to a file.
|
||||||
|
|
||||||
Config:
|
Config:
|
||||||
|
@ -373,24 +373,27 @@ By default this will be the one account you create during the installation proce
|
||||||
But you can expand the list of email addresses by any used email address you want.
|
But you can expand the list of email addresses by any used email address you want.
|
||||||
Registration of new accounts with a listed email address is not possible.
|
Registration of new accounts with a listed email address is not possible.
|
||||||
|
|
||||||
$a->config['admin_email'] = 'you@example.com, buddy@example.com';
|
[config]
|
||||||
|
admin_email = you@example.com, buddy@example.com
|
||||||
|
|
||||||
## PHP Path
|
## PHP Path
|
||||||
|
|
||||||
Some of Friendicas processes are running in the background.
|
Some of Friendicas processes are running in the background.
|
||||||
For this you need to specify the path to the PHP binary to be used.
|
For this you need to specify the path to the PHP binary to be used.
|
||||||
|
|
||||||
$a->config['php_path'] = '{{$phpath}}';
|
[config]
|
||||||
|
php_path = {{$phpath}}
|
||||||
|
|
||||||
## Subdirectory configuration
|
## Subdirectory configuration
|
||||||
|
|
||||||
It is possible to install Friendica into a subdirectory of your webserver.
|
It is possible to install Friendica into a subdirectory of your webserver.
|
||||||
We strongly discurage you from doing so, as this will break federation to other networks (e.g. Diaspora, GNU Socia, Hubzilla)
|
We strongly discourage you from doing so, as this will break federation to other networks (e.g. Diaspora, GNU Socia, Hubzilla)
|
||||||
Say you have a subdirectory for tests and put Friendica into a further subdirectory, the config would be:
|
Say you have a subdirectory for tests and put Friendica into a further subdirectory, the config would be:
|
||||||
|
|
||||||
$a->path = 'tests/friendica';
|
[system]
|
||||||
|
urlpath = tests/friendica
|
||||||
|
|
||||||
## Other exceptions
|
## Other exceptions
|
||||||
|
|
||||||
Furthermore there are some experimental settings, you can read-up in the [Config values that can only be set in .htconfig.php](help/htconfig) section of the documentation.
|
Furthermore there are some experimental settings, you can read-up in the [Config values that can only be set in config/local.ini.php](help/Config) section of the documentation.
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ Updating Friendica
|
||||||
|
|
||||||
If you installed Friendica in the ``path/to/friendica`` folder:
|
If you installed Friendica in the ``path/to/friendica`` folder:
|
||||||
1. Unpack the new Friendica archive in ``path/to/friendica_new``.
|
1. Unpack the new Friendica archive in ``path/to/friendica_new``.
|
||||||
2. Copy ``.htconfig.php``, ``photo/`` and ``proxy/`` from ``path/to/friendica`` to ``path/to/friendica_new``.
|
2. Copy ``config/local.ini.php``, ``photo/`` and ``proxy/`` from ``path/to/friendica`` to ``path/to/friendica_new``.
|
||||||
3. Rename the ``path/to/friendica`` folder to ``path/to/friendica_old``.
|
3. Rename the ``path/to/friendica`` folder to ``path/to/friendica_old``.
|
||||||
4. Rename the ``path/to/friendica_new`` folder to ``path/to/friendica``.
|
4. Rename the ``path/to/friendica_new`` folder to ``path/to/friendica``.
|
||||||
5. Check your site. Note: it may go into maintenance mode to update the database schema.
|
5. Check your site. Note: it may go into maintenance mode to update the database schema.
|
||||||
|
|
|
@ -42,7 +42,7 @@ This will not delete the virtual machine.
|
||||||
9. To ultimately delete the virtual machine run
|
9. To ultimately delete the virtual machine run
|
||||||
|
|
||||||
$> vagrant destroy
|
$> vagrant destroy
|
||||||
$> rm /vagrant/.htconfig.php
|
$> rm /vagrant/config/local.ini.php
|
||||||
|
|
||||||
to make sure that you can start from scratch with another "vagrant up".
|
to make sure that you can start from scratch with another "vagrant up".
|
||||||
|
|
||||||
|
@ -53,6 +53,6 @@ You will then have the following accounts to login:
|
||||||
* friendica1, password friendica1
|
* friendica1, password friendica1
|
||||||
* friendica2, password friendica2 and so on until friendica5
|
* friendica2, password friendica2 and so on until friendica5
|
||||||
* friendica1 is connected to all others. friendica1 has two groups: group1 with friendica2 and friendica4, group2 with friendica3 and friendica5.
|
* friendica1 is connected to all others. friendica1 has two groups: group1 with friendica2 and friendica4, group2 with friendica3 and friendica5.
|
||||||
* friendica2 and friendica3 are conntected. friendica4 and friendica5 are connected.
|
* friendica2 and friendica3 are conntected. friendica4 and friendica5 are connected.
|
||||||
|
|
||||||
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).
|
For further documentation of vagrant, please see [the vagrant*docs*](https://docs.vagrantup.com/v2/).
|
||||||
|
|
|
@ -85,9 +85,9 @@ Zum Konvertieren von Videos in das lizenfreie Videoformat WebM gibt es unter Win
|
||||||
### Ist es möglich, bei mehreren Profilen verschiedene Avatare (Nutzerbilder) zu haben?
|
### Ist es möglich, bei mehreren Profilen verschiedene Avatare (Nutzerbilder) zu haben?
|
||||||
|
|
||||||
Ja.
|
Ja.
|
||||||
Auf Deiner ["Profile verwalten/editieren"-Seite](../profiles) wählst Du zunächst das gewünschte Profil aus.
|
Auf Deiner ["Profile verwalten/editieren"-Seite](../profiles) wählst Du zunächst das gewünschte Profil aus.
|
||||||
Anschließend siehst Du eine Seite mit allen Infos zu diesem Profil.
|
Anschließend siehst Du eine Seite mit allen Infos zu diesem Profil.
|
||||||
Klicke nun oben auf den Link "Profilbild ändern" und lade im nächsten Fenster ein Bild von Deinem PC hoch.
|
Klicke nun oben auf den Link "Profilbild ändern" und lade im nächsten Fenster ein Bild von Deinem PC hoch.
|
||||||
Um Deine privaten Daten zu schützen, wird in Beiträgen nur das Bild aus Deinem öffentlichen Profil angezeigt.
|
Um Deine privaten Daten zu schützen, wird in Beiträgen nur das Bild aus Deinem öffentlichen Profil angezeigt.
|
||||||
|
|
||||||
<a name="contacts"></a>
|
<a name="contacts"></a>
|
||||||
|
@ -180,7 +180,7 @@ Hier ist eine Liste von Clients bei denen dies möglich ist, bzw. die speziell f
|
||||||
<a name="help"></a>
|
<a name="help"></a>
|
||||||
### Wo finde ich Hilfe?
|
### Wo finde ich Hilfe?
|
||||||
|
|
||||||
Wenn Du Probleme mit Deiner Friendica-Seite hast, dann kannst Du die Community in der [Friendica-Support-Gruppe](https://forum.friendi.ca/profile/helpers) oder im [deutschen Friendica-Support-Forum](http://toktan.org/profile/wiki) fragen oder Dir das [deutsche Wiki](http://wiki.toktan.org/doku.php) anschauen.
|
Wenn Du Probleme mit Deiner Friendica-Seite hast, dann kannst Du die Community in der [Friendica-Support-Gruppe](https://forum.friendi.ca/profile/helpers) oder im [deutschen Friendica-Support-Forum](http://toktan.org/profile/wiki) fragen oder Dir das [deutsche Wiki](http://wiki.toktan.org/doku.php) anschauen.
|
||||||
Wenn Du Deinen Account nicht nutzen kannst, kannst Du entweder einen [Testaccount](https://tryfriendica.de) bzw. einen Account auf einer öffentlichen Seite ([Liste](https://dir.friendica.social/servers)) nutzen.
|
Wenn Du Deinen Account nicht nutzen kannst, kannst Du entweder einen [Testaccount](https://tryfriendica.de) bzw. einen Account auf einer öffentlichen Seite ([Liste](https://dir.friendica.social/servers)) nutzen.
|
||||||
|
|
||||||
Wenn du dir keinen weiteren Friendica Account einrichten willst, kannst du auch gerne über einen der folgenden alternativen Kanäle Hilfe suchen:
|
Wenn du dir keinen weiteren Friendica Account einrichten willst, kannst du auch gerne über einen der folgenden alternativen Kanäle Hilfe suchen:
|
||||||
|
@ -199,7 +199,7 @@ Admin
|
||||||
|
|
||||||
Ja, das ist möglich.
|
Ja, das ist möglich.
|
||||||
Es ist allerdings nicht möglich, eine Datenbank durch zwei Domains zu nutzen.
|
Es ist allerdings nicht möglich, eine Datenbank durch zwei Domains zu nutzen.
|
||||||
Solange Du Deine .htconfig.php allerdings so einrichtest, dass das System nicht versucht, eine Installation durchzuführen, kannst Du die richtige Config-Datei in include/$hostname/.htconfig.php hinterlegen.
|
Solange Du Deine config/local.ini.php allerdings so einrichtest, dass das System nicht versucht, eine Installation durchzuführen, kannst Du die richtige Config-Datei in include/$hostname/config/local.ini.php hinterlegen.
|
||||||
Alle Cache-Aspekte und der Zugriffsschutz können pro Instanz konfiguriert werden.
|
Alle Cache-Aspekte und der Zugriffsschutz können pro Instanz konfiguriert werden.
|
||||||
|
|
||||||
<a name="sources"></a>
|
<a name="sources"></a>
|
||||||
|
@ -216,13 +216,13 @@ Wenn Du neue Themen suchst, findest Du sie auf [Friendica-Themes.com](http://fri
|
||||||
<a name="adminaccount1"></a>
|
<a name="adminaccount1"></a>
|
||||||
### Ich habe meine E-Mail Adresse geändern und jetzt ist das Admin Panel verschwunden?
|
### Ich habe meine E-Mail Adresse geändern und jetzt ist das Admin Panel verschwunden?
|
||||||
|
|
||||||
Bitte aktualisiere deine E-Mail Adresse in der <tt>.htconfig.php</tt> Datei.
|
Bitte aktualisiere deine E-Mail Adresse in der <tt>config/local.ini.php</tt> Datei.
|
||||||
|
|
||||||
<a name="adminaccount2"></a>
|
<a name="adminaccount2"></a>
|
||||||
### Kann es mehr als einen Admin auf einer Friendica Instanz geben?
|
### Kann es mehr als einen Admin auf einer Friendica Instanz geben?
|
||||||
|
|
||||||
Ja.
|
Ja.
|
||||||
Du kannst in der <tt>.htconfig.php</tt> Datei mehrere E-Mail Adressen auflisten.
|
Du kannst in der <tt>config/local.ini.php</tt> Datei mehrere E-Mail Adressen auflisten.
|
||||||
Die aufgelisteten Adressen werden mit Kommata von einander getrennt.
|
Die aufgelisteten Adressen werden mit Kommata von einander getrennt.
|
||||||
|
|
||||||
<a name="dbupdate">
|
<a name="dbupdate">
|
||||||
|
|
|
@ -34,7 +34,7 @@ Friendica - Dokumentation und Ressourcen
|
||||||
* [Konnektoren (Connectors) installieren (Twitter/GNU Social)](help/Installing-Connectors)
|
* [Konnektoren (Connectors) installieren (Twitter/GNU Social)](help/Installing-Connectors)
|
||||||
* [Installation eines ejabberd Servers (XMPP-Chat) mit synchronisierten Anmeldedaten](help/install-ejabberd) (EN)
|
* [Installation eines ejabberd Servers (XMPP-Chat) mit synchronisierten Anmeldedaten](help/install-ejabberd) (EN)
|
||||||
* [Betreibe deine Seite mit einem SSL-Zertifikat](help/SSL)
|
* [Betreibe deine Seite mit einem SSL-Zertifikat](help/SSL)
|
||||||
* [Konfigurationswerte, die nur in der .htconfig.php gesetzt werden können](help/htconfig) (EN)
|
* [Konfigurationswerte, die nur in der config/local.ini.php gesetzt werden können](help/Config) (EN)
|
||||||
* [Performance verbessern](help/Improve-Performance)
|
* [Performance verbessern](help/Improve-Performance)
|
||||||
* [Administration Werkzeuge](help/tools) (EN)
|
* [Administration Werkzeuge](help/tools) (EN)
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ Requirements
|
||||||
---
|
---
|
||||||
|
|
||||||
* Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst
|
* Apache mit einer aktiverten mod-rewrite-Funktion und dem Eintrag "Options All", so dass du die lokale .htaccess-Datei nutzen kannst
|
||||||
* PHP 5.6+ (PHP 7 ist aufgrund der Performance empfohlen)
|
* PHP 5.6.1+ (PHP 7 ist aufgrund der Performance empfohlen)
|
||||||
* PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei
|
* PHP *Kommandozeilen*-Zugang mit register_argc_argv auf "true" gesetzt in der php.ini-Datei
|
||||||
* Curl, GD, PDO, MySQLi, xml, zip und OpenSSL-Erweiterung
|
* Curl, GD, PDO, MySQLi, xml, zip und OpenSSL-Erweiterung
|
||||||
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
|
* Das POSIX Modul muss aktiviert sein ([CentOS, RHEL](http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7http://www.bigsoft.co.uk/blog/index.php/2014/12/08/posix-php-commands-not-working-under-centos-7) haben dies z.B. deaktiviert)
|
||||||
|
@ -56,7 +56,7 @@ Stelle sicher, dass der Ordner *view/smarty3* existiert and von dem Webserver-Be
|
||||||
mkdir view/smarty3
|
mkdir view/smarty3
|
||||||
chmod 775 view/smarty3
|
chmod 775 view/smarty3
|
||||||
|
|
||||||
Falls Addons installiert werden sollen: Gehe in den Friendica-Ordner
|
Falls Addons installiert werden sollen: Gehe in den Friendica-Ordner
|
||||||
|
|
||||||
cd mywebsite
|
cd mywebsite
|
||||||
|
|
||||||
|
@ -98,19 +98,19 @@ Starte MySQL dann neu und es sollte klappen.
|
||||||
|
|
||||||
### Option A: Der manuelle Installer
|
### Option A: Der manuelle Installer
|
||||||
|
|
||||||
Besuche deine Webseite mit deinem Browser und befolge die Anleitung.
|
Besuche deine Webseite mit deinem Browser und befolge die Anleitung.
|
||||||
Bitte beachte jeden Fehler und korrigiere diese, bevor du fortfährst.
|
Bitte beachte jeden Fehler und korrigiere diese, bevor du fortfährst.
|
||||||
|
|
||||||
Falls du einen Port für die Datenbankverbindung angeben musst, kannst du diesen in der Host-Eingabe Zeile angeben.
|
Falls du einen Port für die Datenbankverbindung angeben musst, kannst du diesen in der Host-Eingabe Zeile angeben.
|
||||||
|
|
||||||
*Wenn* die manuelle Installation aus irgendeinem Grund fehlschlägt, dann prüfe das Folgende:
|
*Wenn* die manuelle Installation aus irgendeinem Grund fehlschlägt, dann prüfe das Folgende:
|
||||||
* ".htconfig.php" existiert ... wenn nicht, bearbeite die „htconfig.php“ und ändere die Systemeinstellungen. Benenne sie um in „.htconfig.php".
|
* "config/local.ini.php" existiert ... wenn nicht, bearbeite die „config/local-sample.ini.php“ und ändere die Systemeinstellungen. Benenne sie um in „config/local.ini.php".
|
||||||
* die Datenbank beinhaltet Daten. ... wenn nicht, importiere den Inhalt der Datei "database.sql" mit phpmyadmin oder per mysql-Kommandozeile.
|
* die Datenbank beinhaltet Daten. ... wenn nicht, importiere den Inhalt der Datei "database.sql" mit phpmyadmin oder per mysql-Kommandozeile.
|
||||||
|
|
||||||
Besuche deine Seite an diesem Punkt wieder und registriere deinen persönlichen Account.
|
Besuche deine Seite an diesem Punkt wieder und registriere deinen persönlichen Account.
|
||||||
Alle Registrierungsprobleme sollten automatisch behebbar sein.
|
Alle Registrierungsprobleme sollten automatisch behebbar sein.
|
||||||
Wenn du irgendwelche **kritischen** Fehler zu diesen Zeitpunkt erhalten solltest, deutet das darauf hin, dass die Datenbank nicht korrekt installiert wurde.
|
Wenn du irgendwelche **kritischen** Fehler zu diesen Zeitpunkt erhalten solltest, deutet das darauf hin, dass die Datenbank nicht korrekt installiert wurde.
|
||||||
Du kannst bei Bedarf die Datei .htconfig.php verschieben/umbenennen und die Datenbank leeren (als „Dropping“ bezeichnet), so dass du mit einem sauberen System neu starten kannst.
|
Du kannst bei Bedarf die Datei config/local.ini.php verschieben/umbenennen und die Datenbank leeren (als „Dropping“ bezeichnet), so dass du mit einem sauberen System neu starten kannst.
|
||||||
|
|
||||||
### Option B: Starte das manuelle Installationsscript
|
### Option B: Starte das manuelle Installationsscript
|
||||||
|
|
||||||
|
@ -127,8 +127,8 @@ Oder falls du alle optionalen Checks ausfürehn lassen möchtest, benutze diese
|
||||||
bin/console autoinstall -a
|
bin/console autoinstall -a
|
||||||
|
|
||||||
*Wenn* die automatisierte Installation aus irgendeinem Grund fehlschlägt, dann prüfe das Folgende:
|
*Wenn* die automatisierte Installation aus irgendeinem Grund fehlschlägt, dann prüfe das Folgende:
|
||||||
* Existiert die `.htconfig.php`? Falls ja, wird die automatisierte Installation nicht gestartet.
|
* Existiert die `config/local.ini.php`? Falls ja, wird die automatisierte Installation nicht gestartet.
|
||||||
* Sind Einstellungen in der `.htconfig.php` korrekt? Falls nicht, bitte bearbeite diese Datei erneut.
|
* Sind Einstellungen in der `config/local.ini.php` korrekt? Falls nicht, bitte bearbeite diese Datei erneut.
|
||||||
* Ist die leere MySQL-Datenbank erstellt? Falls nicht, erstelle diese.
|
* Ist die leere MySQL-Datenbank erstellt? Falls nicht, erstelle diese.
|
||||||
|
|
||||||
Für mehr Informationen kannst du diese Option verwenden:
|
Für mehr Informationen kannst du diese Option verwenden:
|
||||||
|
@ -137,7 +137,7 @@ Für mehr Informationen kannst du diese Option verwenden:
|
||||||
|
|
||||||
### Einen Worker einrichten
|
### Einen Worker einrichten
|
||||||
|
|
||||||
Erstelle einen Cron job oder einen regelmäßigen Task, um den Poller alle 5-10 Minuten im Hintergrund ablaufen zu lassen.
|
Erstelle einen Cron job oder einen regelmäßigen Task, um den Poller alle 5-10 Minuten im Hintergrund ablaufen zu lassen.
|
||||||
Beispiel:
|
Beispiel:
|
||||||
|
|
||||||
cd /base/directory; /path/to/php bin/worker.php
|
cd /base/directory; /path/to/php bin/worker.php
|
||||||
|
@ -160,5 +160,5 @@ Es werden schlimme Dinge geschehen.
|
||||||
Sei es nun ein Hardwareversagen oder eine kaputte Datenbank.
|
Sei es nun ein Hardwareversagen oder eine kaputte Datenbank.
|
||||||
Deshalb solltest du dir, nachdem die Installation deines Friendica Knotens abgeschlossen ist, einen Backup Plan erstellen.
|
Deshalb solltest du dir, nachdem die Installation deines Friendica Knotens abgeschlossen ist, einen Backup Plan erstellen.
|
||||||
|
|
||||||
Die wichtigste Datei ist die `.htconfig.php` im Stammverzeichnis deiner Friendica Installation.
|
Die wichtigste Datei ist die `config/local.ini.php` im Stammverzeichnis deiner Friendica Installation.
|
||||||
Und da alle Daten in der Datenbank gespeichert werden, solltest du einen nicht all zu alten Dump der Friendica Datenbank zur Hand haben, solltest du deinen Knoten wieder herstellen müssen.
|
Und da alle Daten in der Datenbank gespeichert werden, solltest du einen nicht all zu alten Dump der Friendica Datenbank zur Hand haben, solltest du deinen Knoten wieder herstellen müssen.
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
Konnektoren installieren (Twitter/GNU Social)
|
Konnektoren installieren (Twitter/GNU Social)
|
||||||
==================================================
|
==================================================
|
||||||
|
|
||||||
* [Zur Startseite der Hilfe](help)
|
* [Zur Startseite der Hilfe](help)
|
||||||
|
|
||||||
Friendica nutzt Erweiterung, um die Verbindung zu anderen Netzwerken wie Twitter oder App.net zu gewährleisten.
|
Friendica nutzt Erweiterung, um die Verbindung zu anderen Netzwerken wie Twitter oder App.net zu gewährleisten.
|
||||||
|
|
||||||
Es gibt außerdem ein Erweiterung, um über einen bestehenden GNU Social-Account diesen Service zu nutzen.
|
Es gibt außerdem ein Erweiterung, um über einen bestehenden GNU Social-Account diesen Service zu nutzen.
|
||||||
Du brauchst dieses Erweiterung aber nicht, um mit GNU Social-Mitgliedern von Friendica aus zu kommunizieren - es sei denn, du wünschst es, über einen existierenden Account einen Beitrag zu schreiben.
|
Du brauchst dieses Erweiterung aber nicht, um mit GNU Social-Mitgliedern von Friendica aus zu kommunizieren - es sei denn, du wünschst es, über einen existierenden Account einen Beitrag zu schreiben.
|
||||||
|
|
||||||
Alle drei Erweiterung benötigen einen Account im gewünschten Netzwerk.
|
Alle drei Erweiterung benötigen einen Account im gewünschten Netzwerk.
|
||||||
Zusätzlich musst du (bzw. der Administrator der Seite) einen API-Schlüssel holen, um einen authentifizierten Zugriff zu deinem Friendica-Server herstellen zu lassen.
|
Zusätzlich musst du (bzw. der Administrator der Seite) einen API-Schlüssel holen, um einen authentifizierten Zugriff zu deinem Friendica-Server herstellen zu lassen.
|
||||||
|
|
||||||
|
|
||||||
**Seitenkonfiguration**
|
**Seitenkonfiguration**
|
||||||
|
|
||||||
Erweiterung müssen vom Administrator installiert werden, bevor sie genutzt werden können.
|
Erweiterung müssen vom Administrator installiert werden, bevor sie genutzt werden können.
|
||||||
Dieses kann über das Administrationsmenü erstellt werden.
|
Dieses kann über das Administrationsmenü erstellt werden.
|
||||||
|
|
||||||
Jeder der Konnektoren benötigt zudem einen API-Schlüssel vom Service, der verbunden werden soll.
|
Jeder der Konnektoren benötigt zudem einen API-Schlüssel vom Service, der verbunden werden soll.
|
||||||
Einige Erweiterung erlaube es, diese Informationen auf den Administrationsseiten einzustellen, wohingegen andere eine direkte Bearbeitung der Konfigurationsdatei ".htconfig.php" erfordern.
|
Einige Erweiterung erlaube es, diese Informationen auf den Administrationsseiten einzustellen, wohingegen andere eine direkte Bearbeitung der Konfigurationsdatei "config/local.ini.php" erfordern.
|
||||||
Der Weg, um diese Schlüssel zu erhalten, variiert stark, jedoch brauchen fast alle einen bestehenden Account im gewünschten Service.
|
Der Weg, um diese Schlüssel zu erhalten, variiert stark, jedoch brauchen fast alle einen bestehenden Account im gewünschten Service.
|
||||||
Einmal installiert, können diese Schlüssel von allen Seitennutzern genutzt werden.
|
Einmal installiert, können diese Schlüssel von allen Seitennutzern genutzt werden.
|
||||||
|
|
||||||
Im Folgenden findest du die Einstellungen für die verschiedenen Services (viele dieser Informationen kommen direkt aus den Quelldateien der Erweiterung):
|
Im Folgenden findest du die Einstellungen für die verschiedenen Services (viele dieser Informationen kommen direkt aus den Quelldateien der Erweiterung):
|
||||||
|
@ -37,11 +37,12 @@ Um dieses Erweiterung zu nutzen, benötigst du einen OAuth Consumer-Schlüsselpa
|
||||||
|
|
||||||
Registriere deine Friendica-Seite als "Client"-Anwendung mit "Read&Write"-Zugriff. Wir benötigen "Twitter als Login" nicht. Sobald du deine Anwendung installiert hast, erhältst du das Schlüsselpaar für deine Seite.
|
Registriere deine Friendica-Seite als "Client"-Anwendung mit "Read&Write"-Zugriff. Wir benötigen "Twitter als Login" nicht. Sobald du deine Anwendung installiert hast, erhältst du das Schlüsselpaar für deine Seite.
|
||||||
|
|
||||||
Trage dieses Schlüsselpaar in deine globale ".htconfig.php"-Datei ein.
|
Trage dieses Schlüsselpaar in deine globale "config/local.ini.php"-Datei ein.
|
||||||
|
|
||||||
```
|
```
|
||||||
$a->config['twitter']['consumerkey'] = 'your consumer_key here';
|
[twitter]
|
||||||
$a->config['twitter']['consumersecret'] = 'your consumer_secret here';
|
consumerkey = your consumer_key here
|
||||||
|
consumersecret = your consumer_secret here
|
||||||
```
|
```
|
||||||
|
|
||||||
Anschließend kann der Nutzer deiner Seite die Twitter-Einstellungen selbst eintragen: "Einstellungen -> Connector Einstellungen".
|
Anschließend kann der Nutzer deiner Seite die Twitter-Einstellungen selbst eintragen: "Einstellungen -> Connector Einstellungen".
|
||||||
|
@ -63,10 +64,10 @@ Wenn das Addon aktiv ist, muss der Nutzer die folgenden Einstellungen vornehmen,
|
||||||
|
|
||||||
Um das OAuth-Schlüsselpaar zu erhalten, muss der Nutzer
|
Um das OAuth-Schlüsselpaar zu erhalten, muss der Nutzer
|
||||||
|
|
||||||
(a) seinen Friendica-Admin fragen, ob bereits ein Schlüsselpaar existiert oder
|
(a) seinen Friendica-Admin fragen, ob bereits ein Schlüsselpaar existiert oder
|
||||||
(b) einen Friendica-Server als Anwendung auf dem GNU Social-Server anmelden.
|
(b) einen Friendica-Server als Anwendung auf dem GNU Social-Server anmelden.
|
||||||
|
|
||||||
Dies kann über Einstellungen --> Connections --> "Register an OAuth client application" -> "Register a new application" auf dem GNU Social-Server durchgeführt werden.
|
Dies kann über Einstellungen --> Connections --> "Register an OAuth client application" -> "Register a new application" auf dem GNU Social-Server durchgeführt werden.
|
||||||
|
|
||||||
Während der Registrierung des OAuth-Clients ist Folgendes zu beachten:
|
Während der Registrierung des OAuth-Clients ist Folgendes zu beachten:
|
||||||
|
|
||||||
|
@ -76,9 +77,9 @@ Während der Registrierung des OAuth-Clients ist Folgendes zu beachten:
|
||||||
* stelle Lese- und Schreibrechte ein
|
* stelle Lese- und Schreibrechte ein
|
||||||
* die Quell-URL sollte die URL deines Friendica-Servers sein
|
* die Quell-URL sollte die URL deines Friendica-Servers sein
|
||||||
|
|
||||||
Sobald die benötigten Daten gespeichert sind, musst du deinen Friendica-Account mit GNU Social verbinden.
|
Sobald die benötigten Daten gespeichert sind, musst du deinen Friendica-Account mit GNU Social verbinden.
|
||||||
Das kannst du über Einstellungen --> Connector-Einstellungen durchführen.
|
Das kannst du über Einstellungen --> Connector-Einstellungen durchführen.
|
||||||
Folge dem "Einloggen mit GNU Social"-Button, erlaube den Zugriff und kopiere den Sicherheitscode in die entsprechende Box.
|
Folge dem "Einloggen mit GNU Social"-Button, erlaube den Zugriff und kopiere den Sicherheitscode in die entsprechende Box.
|
||||||
Friendica wird dann versuchen, die abschließende OAuth-Einstellungen über die API zu beziehen.
|
Friendica wird dann versuchen, die abschließende OAuth-Einstellungen über die API zu beziehen.
|
||||||
|
|
||||||
Wenn es geklappt hat, kannst du in den Einstellungen festlegen, ob deine öffentlichen Nachrichten automatisch in deinem GNU Social-Account erscheinen soll (achte hierbei auf das kleine Schloss-Symbol im Status-Editor)
|
Wenn es geklappt hat, kannst du in den Einstellungen festlegen, ob deine öffentlichen Nachrichten automatisch in deinem GNU Social-Account erscheinen soll (achte hierbei auf das kleine Schloss-Symbol im Status-Editor)
|
||||||
|
|
|
@ -8,8 +8,8 @@ Auf der Startseite des Admin Panels werden die Informationen zu der Instanz zusa
|
||||||
Die erste Zahl gibt die Anzahl von Nachrichten an, die nicht zugestellt werden konnten.
|
Die erste Zahl gibt die Anzahl von Nachrichten an, die nicht zugestellt werden konnten.
|
||||||
Die Zustellung wird zu einem späteren Zeitpunkt noch einmal versucht.
|
Die Zustellung wird zu einem späteren Zeitpunkt noch einmal versucht.
|
||||||
Unter dem Punkt "Warteschlange Inspizieren" kannst du einen schnellen Blick auf die zweite Warteschlange werfen.
|
Unter dem Punkt "Warteschlange Inspizieren" kannst du einen schnellen Blick auf die zweite Warteschlange werfen.
|
||||||
Die zweite Zahl steht für die Anzahl der Aufgaben, die die Worker noch vor sich haben.
|
Die zweite Zahl steht für die Anzahl der Aufgaben, die die Worker noch vor sich haben.
|
||||||
Die Worker arbeiten Hintergrundprozesse ab.
|
Die Worker arbeiten Hintergrundprozesse ab.
|
||||||
Die Aufgaben der Worker sind priorisiert und werden anhand dieser Prioritäten abgearbeitet.
|
Die Aufgaben der Worker sind priorisiert und werden anhand dieser Prioritäten abgearbeitet.
|
||||||
|
|
||||||
Desweiteren findest du eine Übersicht über die Accounts auf dem Friendica Knoten, die unter dem Punkt "Nutzer" moderiert werden können.
|
Desweiteren findest du eine Übersicht über die Accounts auf dem Friendica Knoten, die unter dem Punkt "Nutzer" moderiert werden können.
|
||||||
|
@ -31,7 +31,7 @@ Da die meisten Konfigurationsoptionen einen Hilfstext im Admin Panel haben, kann
|
||||||
|
|
||||||
#### Banner/Logo
|
#### Banner/Logo
|
||||||
|
|
||||||
Hiermit legst du das Banner der Seite fest. Standardmäßig ist das Friendica-Logo und der Name festgelegt.
|
Hiermit legst du das Banner der Seite fest. Standardmäßig ist das Friendica-Logo und der Name festgelegt.
|
||||||
Du kannst hierfür HTML/CSS nutzen, um den Inhalt zu gestalten und/oder die Position zu ändern, wenn es nicht bereits voreingestellt ist.
|
Du kannst hierfür HTML/CSS nutzen, um den Inhalt zu gestalten und/oder die Position zu ändern, wenn es nicht bereits voreingestellt ist.
|
||||||
|
|
||||||
#### Systensprache
|
#### Systensprache
|
||||||
|
@ -63,33 +63,33 @@ Dabei kannst du zwischen den folgenden Optionen wählen:
|
||||||
* **Bedarf der Zustimmung**: Jeder kann ein Nutzerkonto anlegen. Dieses muss allerdings durch den Admin freigeschaltet werden, bevor es verwendet werden kann.
|
* **Bedarf der Zustimmung**: Jeder kann ein Nutzerkonto anlegen. Dieses muss allerdings durch den Admin freigeschaltet werden, bevor es verwendet werden kann.
|
||||||
* **Geschlossen**: Es können keine weiteren Nutzerkonten angelegt werden.
|
* **Geschlossen**: Es können keine weiteren Nutzerkonten angelegt werden.
|
||||||
|
|
||||||
##### Einladungen
|
##### Einladungen
|
||||||
|
|
||||||
Zusätzlich zu den oben genannten Möglichkeiten, kann die Registrierung eines neuen Nutzerkontos an eine Einladung durch einen bestehenden Nutzer gekoppelt werden.
|
Zusätzlich zu den oben genannten Möglichkeiten, kann die Registrierung eines neuen Nutzerkontos an eine Einladung durch einen bestehenden Nutzer gekoppelt werden.
|
||||||
Hierzu muss in der [.htconfig.php](/help/htconfig) Datei die Option `invitation_only` aktiviert und als Registrierungsmethode entweder *Offen* oder *Bedarf der Zustimmung* gewählt werden.
|
Hierzu muss in der [config/local.ini.php](/help/Config) Datei die Option `invitation_only` aktiviert und als Registrierungsmethode entweder *Offen* oder *Bedarf der Zustimmung* gewählt werden.
|
||||||
|
|
||||||
#### Namen auf Vollständigkeit überprüfen
|
#### Namen auf Vollständigkeit überprüfen
|
||||||
|
|
||||||
Es kann vorkommen, dass viele Spammer versuchen, sich auf deiner Seite zu registrieren.
|
Es kann vorkommen, dass viele Spammer versuchen, sich auf deiner Seite zu registrieren.
|
||||||
In Testphasen haben wir festgestellt, dass diese automatischen Registrierungen das Feld "Vollständiger Name" oft nur mit Namen ausfüllen, die kein Leerzeichen beinhalten.
|
In Testphasen haben wir festgestellt, dass diese automatischen Registrierungen das Feld "Vollständiger Name" oft nur mit Namen ausfüllen, die kein Leerzeichen beinhalten.
|
||||||
Wenn du Leuten erlauben willst, sich nur mit einem Namen anzumelden, dann setze die Einstellung auf "true".
|
Wenn du Leuten erlauben willst, sich nur mit einem Namen anzumelden, dann setze die Einstellung auf "true".
|
||||||
Die Standardeinstellung ist auf "false" gesetzt.
|
Die Standardeinstellung ist auf "false" gesetzt.
|
||||||
|
|
||||||
#### OpenID Unterstützung
|
#### OpenID Unterstützung
|
||||||
|
|
||||||
Standardmäßig wird OpenID für die Registrierung und für Logins genutzt.
|
Standardmäßig wird OpenID für die Registrierung und für Logins genutzt.
|
||||||
Wenn du nicht willst, dass OpenID-Strukturen für dein System übernommen werden, dann setze "no_openid" auf "true".
|
Wenn du nicht willst, dass OpenID-Strukturen für dein System übernommen werden, dann setze "no_openid" auf "true".
|
||||||
Standardmäßig ist hier "false" gesetzt.
|
Standardmäßig ist hier "false" gesetzt.
|
||||||
|
|
||||||
#### Unterbinde Mehrfachregistrierung
|
#### Unterbinde Mehrfachregistrierung
|
||||||
|
|
||||||
Um mehrfache Seiten zu erstellen, muss sich eine Person mehrfach registrieren können.
|
Um mehrfache Seiten zu erstellen, muss sich eine Person mehrfach registrieren können.
|
||||||
Deine Seiteneinstellung kann Registrierungen komplett blockieren oder an Bedingungen knüpfen.
|
Deine Seiteneinstellung kann Registrierungen komplett blockieren oder an Bedingungen knüpfen.
|
||||||
Standardmäßig können eingeloggte Nutzer weitere Accounts für die Seitenerstellung registrieren.
|
Standardmäßig können eingeloggte Nutzer weitere Accounts für die Seitenerstellung registrieren.
|
||||||
Hier ist weiterhin eine Bestätigung notwendig, wenn "REGISTER_APPROVE" ausgewählt ist.
|
Hier ist weiterhin eine Bestätigung notwendig, wenn "REGISTER_APPROVE" ausgewählt ist.
|
||||||
Wenn du die Erstellung weiterer Accounts blockieren willst, dann setze die Einstellung "block_extended_register" auf "true".
|
Wenn du die Erstellung weiterer Accounts blockieren willst, dann setze die Einstellung "block_extended_register" auf "true".
|
||||||
Standardmäßig ist hier "false" gesetzt.
|
Standardmäßig ist hier "false" gesetzt.
|
||||||
|
|
||||||
### Datei hochladen
|
### Datei hochladen
|
||||||
|
|
||||||
#### Maximale Bildgröße
|
#### Maximale Bildgröße
|
||||||
|
@ -100,26 +100,26 @@ Maximale Bild-Dateigröße in Byte. Standardmäßig ist 0 gesetzt, was bedeutet,
|
||||||
|
|
||||||
#### URL des weltweiten Verzeichnisses
|
#### URL des weltweiten Verzeichnisses
|
||||||
|
|
||||||
Mit diesem Befehl wird die URL eingestellt, die zum Update des globalen Verzeichnisses genutzt wird.
|
Mit diesem Befehl wird die URL eingestellt, die zum Update des globalen Verzeichnisses genutzt wird.
|
||||||
Dieser Befehl ist in der Standardkonfiguration enthalten.
|
Dieser Befehl ist in der Standardkonfiguration enthalten.
|
||||||
Der nicht dokumentierte Teil dieser Einstellung ist, dass das globale Verzeichnis gar nicht verfügbar ist, wenn diese Einstellung nicht gesetzt wird.
|
Der nicht dokumentierte Teil dieser Einstellung ist, dass das globale Verzeichnis gar nicht verfügbar ist, wenn diese Einstellung nicht gesetzt wird.
|
||||||
Dies erlaubt eine private Kommunikation, die komplett vom globalen Verzeichnis isoliert ist.
|
Dies erlaubt eine private Kommunikation, die komplett vom globalen Verzeichnis isoliert ist.
|
||||||
|
|
||||||
#### Erzwinge Veröffentlichung
|
#### Erzwinge Veröffentlichung
|
||||||
|
|
||||||
Standardmäßig können Nutzer selbst auswählen, ob ihr Profil im Seitenverzeichnis erscheint.
|
Standardmäßig können Nutzer selbst auswählen, ob ihr Profil im Seitenverzeichnis erscheint.
|
||||||
Diese Einstellung zwingt alle Nutzer dazu, im Verzeichnis zu erscheinen.
|
Diese Einstellung zwingt alle Nutzer dazu, im Verzeichnis zu erscheinen.
|
||||||
Diese Einstellung kann vom Nutzer nicht deaktiviert werden. Die Standardeinstellung steht auf "false".
|
Diese Einstellung kann vom Nutzer nicht deaktiviert werden. Die Standardeinstellung steht auf "false".
|
||||||
|
|
||||||
#### Öffentlichen Zugriff blockieren
|
#### Öffentlichen Zugriff blockieren
|
||||||
|
|
||||||
Aktiviere diese Einstellung um den öffentlichen Zugriff auf alle Seiten zu sperren, solange man nicht eingeloggt ist.
|
Aktiviere diese Einstellung um den öffentlichen Zugriff auf alle Seiten zu sperren, solange man nicht eingeloggt ist.
|
||||||
Das blockiert die Ansicht von Profilen, Freunden, Fotos, vom Verzeichnis und den Suchseiten.
|
Das blockiert die Ansicht von Profilen, Freunden, Fotos, vom Verzeichnis und den Suchseiten.
|
||||||
Ein Nebeneffekt ist, dass Einträge dieser Seite nicht im globalen Verzeichnis erscheinen.
|
Ein Nebeneffekt ist, dass Einträge dieser Seite nicht im globalen Verzeichnis erscheinen.
|
||||||
Wir empfehlen, speziell diese Einstellung auszuschalten (die Einstellung ist an anderer Stelle auf dieser Seite erklärt).
|
Wir empfehlen, speziell diese Einstellung auszuschalten (die Einstellung ist an anderer Stelle auf dieser Seite erklärt).
|
||||||
Beachte: das ist speziell für Seiten, die beabsichtigen, von anderen Friendica-Netzwerken abgeschottet zu sein.
|
Beachte: das ist speziell für Seiten, die beabsichtigen, von anderen Friendica-Netzwerken abgeschottet zu sein.
|
||||||
Unautorisierte Personen haben ebenfalls nicht die Möglichkeit, Freundschaftsanfragen von Seitennutzern zu beantworten.
|
Unautorisierte Personen haben ebenfalls nicht die Möglichkeit, Freundschaftsanfragen von Seitennutzern zu beantworten.
|
||||||
Die Standardeinstellung ist deaktiviert.
|
Die Standardeinstellung ist deaktiviert.
|
||||||
Verfügbar in Version 2.2 und höher.
|
Verfügbar in Version 2.2 und höher.
|
||||||
|
|
||||||
#### Für Besucher verfügbare Gemeinschaftsseiten
|
#### Für Besucher verfügbare Gemeinschaftsseiten
|
||||||
|
@ -133,15 +133,15 @@ Angemeldete Nutzer des Knotens können grundsätzlich beide Seiten verwenden.
|
||||||
|
|
||||||
#### Erlaubte Domains für Kontakte
|
#### Erlaubte Domains für Kontakte
|
||||||
|
|
||||||
Kommagetrennte Liste von Domains, welche eine Freundschaft mit dieser Seite eingehen dürfen.
|
Kommagetrennte Liste von Domains, welche eine Freundschaft mit dieser Seite eingehen dürfen.
|
||||||
Wildcards werden akzeptiert (Wildcard-Unterstützung unter Windows benötigt PHP5.3) Standardmäßig sind alle gültigen Domains erlaubt.
|
Wildcards werden akzeptiert (Wildcard-Unterstützung unter Windows benötigt PHP5.3) Standardmäßig sind alle gültigen Domains erlaubt.
|
||||||
|
|
||||||
Mit dieser Option kann man einfach geschlossene Netzwerke, z.B. im schulischen Bereich aufbauen, aus denen nicht mit dem Rest des Netzwerks kommuniziert werden soll.
|
Mit dieser Option kann man einfach geschlossene Netzwerke, z.B. im schulischen Bereich aufbauen, aus denen nicht mit dem Rest des Netzwerks kommuniziert werden soll.
|
||||||
|
|
||||||
#### Erlaubte Domains für E-Mails
|
#### Erlaubte Domains für E-Mails
|
||||||
|
|
||||||
Kommagetrennte Liste von Domains, welche bei der Registrierung als Part der Email-Adresse erlaubt sind.
|
Kommagetrennte Liste von Domains, welche bei der Registrierung als Part der Email-Adresse erlaubt sind.
|
||||||
Das grenzt Leute aus, die nicht Teil der Gruppe oder Organisation sind.
|
Das grenzt Leute aus, die nicht Teil der Gruppe oder Organisation sind.
|
||||||
Wildcards werden akzeptiert (Wildcard-Unterstützung unter Windows benötigt PHP5.3) Standardmäßig sind alle gültigen Email-Adressen erlaubt.
|
Wildcards werden akzeptiert (Wildcard-Unterstützung unter Windows benötigt PHP5.3) Standardmäßig sind alle gültigen Email-Adressen erlaubt.
|
||||||
|
|
||||||
#### Nutzern erlauben das remote_self Flag zu setzen
|
#### Nutzern erlauben das remote_self Flag zu setzen
|
||||||
|
@ -172,23 +172,23 @@ Wenn deine Seite eine Proxy-Einstellung nutzt, musst du diese Einstellungen vorn
|
||||||
|
|
||||||
#### Netzwerk Wartezeit
|
#### Netzwerk Wartezeit
|
||||||
|
|
||||||
Legt fest, wie lange das Netzwerk warten soll, bevor ein Timeout eintritt.
|
Legt fest, wie lange das Netzwerk warten soll, bevor ein Timeout eintritt.
|
||||||
Der Wert wird in Sekunden angegeben. Standardmäßig ist 60 eingestellt; 0 steht für "unbegrenzt" (nicht empfohlen).
|
Der Wert wird in Sekunden angegeben. Standardmäßig ist 60 eingestellt; 0 steht für "unbegrenzt" (nicht empfohlen).
|
||||||
|
|
||||||
#### UTF-8 Reguläre Ausdrücke
|
#### UTF-8 Reguläre Ausdrücke
|
||||||
|
|
||||||
Während der Registrierung werden die Namen daraufhin geprüft, ob sie reguläre UTF-8-Ausdrücke nutzen.
|
Während der Registrierung werden die Namen daraufhin geprüft, ob sie reguläre UTF-8-Ausdrücke nutzen.
|
||||||
Hierfür wird PHP benötigt, um mit einer speziellen Einstellung kompiliert zu werden, die UTF-8-Ausdrücke benutzt.
|
Hierfür wird PHP benötigt, um mit einer speziellen Einstellung kompiliert zu werden, die UTF-8-Ausdrücke benutzt.
|
||||||
Wenn du absolut keine Möglichkeit hast, Accounts zu registrieren, setze diesen Wert auf ja.
|
Wenn du absolut keine Möglichkeit hast, Accounts zu registrieren, setze diesen Wert auf ja.
|
||||||
|
|
||||||
#### SSL Überprüfen
|
#### SSL Überprüfen
|
||||||
|
|
||||||
Standardmäßig erlaubt Friendica SSL-Kommunikation von Seiten, die "selbst unterzeichnete" SSL-Zertifikate nutzen.
|
Standardmäßig erlaubt Friendica SSL-Kommunikation von Seiten, die "selbst unterzeichnete" SSL-Zertifikate nutzen.
|
||||||
Um eine weitreichende Kompatibilität mit anderen Netzwerken und Browsern zu gewährleisten, empfehlen wir, selbst unterzeichnete Zertifikate **nicht** zu nutzen.
|
Um eine weitreichende Kompatibilität mit anderen Netzwerken und Browsern zu gewährleisten, empfehlen wir, selbst unterzeichnete Zertifikate **nicht** zu nutzen.
|
||||||
Aber wir halten dich nicht davon ab, solche zu nutzen. SSL verschlüsselt alle Daten zwischen den Webseiten (und für deinen Browser), was dir eine komplett verschlüsselte Kommunikation erlaubt.
|
Aber wir halten dich nicht davon ab, solche zu nutzen. SSL verschlüsselt alle Daten zwischen den Webseiten (und für deinen Browser), was dir eine komplett verschlüsselte Kommunikation erlaubt.
|
||||||
Auch schützt es deine Login-Daten vor Datendiebstahl. Selbst unterzeichnete Zertifikate können kostenlos erstellt werden.
|
Auch schützt es deine Login-Daten vor Datendiebstahl. Selbst unterzeichnete Zertifikate können kostenlos erstellt werden.
|
||||||
Diese Zertifikate können allerdings Opfer eines sogenannten ["man-in-the-middle"-Angriffs](http://de.wikipedia.org/wiki/Man-in-the-middle-Angriff) werden, und sind daher weniger bevorzugt.
|
Diese Zertifikate können allerdings Opfer eines sogenannten ["man-in-the-middle"-Angriffs](http://de.wikipedia.org/wiki/Man-in-the-middle-Angriff) werden, und sind daher weniger bevorzugt.
|
||||||
Wenn du es wünscht, kannst du eine strikte Zertifikatabfrage einstellen.
|
Wenn du es wünscht, kannst du eine strikte Zertifikatabfrage einstellen.
|
||||||
Das führt dazu, dass du keinerlei Verbindung zu einer selbst unterzeichneten SSL-Seite erstellen kannst
|
Das führt dazu, dass du keinerlei Verbindung zu einer selbst unterzeichneten SSL-Seite erstellen kannst
|
||||||
|
|
||||||
### Automatisch ein Kontaktverzeichnis erstellen
|
### Automatisch ein Kontaktverzeichnis erstellen
|
||||||
|
@ -313,7 +313,7 @@ Du solltest deshalb einen Dienst zur [log rotation](https://en.wikipedia.org/wik
|
||||||
**Bekannte Probleme**: Der Dateiname `friendica.log` kann bei speziellen Server Konfigurationen zu Problemen führen (siehe [issue 2209](https://github.com/friendica/friendica/issues/2209)).
|
**Bekannte Probleme**: Der Dateiname `friendica.log` kann bei speziellen Server Konfigurationen zu Problemen führen (siehe [issue 2209](https://github.com/friendica/friendica/issues/2209)).
|
||||||
|
|
||||||
Normalerweise werden Fehler- und Warnmeldungen von PHP unterdrückt.
|
Normalerweise werden Fehler- und Warnmeldungen von PHP unterdrückt.
|
||||||
Wenn du sie aktivieren willst, musst du folgendes in der `.htconfig.php` Datei eintragen um die Meldungen in die Datei `php.out` zu speichern
|
Wenn du sie aktivieren willst, musst du folgendes in der `config/local.ini.php` Datei eintragen um die Meldungen in die Datei `php.out` zu speichern
|
||||||
|
|
||||||
error_reporting(E_ERROR | E_WARNING | E_PARSE );
|
error_reporting(E_ERROR | E_WARNING | E_PARSE );
|
||||||
ini_set('error_log','php.out');
|
ini_set('error_log','php.out');
|
||||||
|
@ -367,14 +367,16 @@ Normalerweise trifft dies auf den ersten Account zu, der nach der Installation a
|
||||||
Die Liste der E-Mail Adressen kann aber einfach erweitert werden.
|
Die Liste der E-Mail Adressen kann aber einfach erweitert werden.
|
||||||
Mit keiner der angegebenen E-Mail Adressen können weitere Accounts registriert werden.
|
Mit keiner der angegebenen E-Mail Adressen können weitere Accounts registriert werden.
|
||||||
|
|
||||||
$a->config['admin_email'] = 'you@example.com, buddy@example.com';
|
[config]
|
||||||
|
admin_email = you@example.com, buddy@example.com
|
||||||
|
|
||||||
## PHP Pfad
|
## PHP Pfad
|
||||||
|
|
||||||
Einige Prozesse von Friendica laufen im Hintergrund.
|
Einige Prozesse von Friendica laufen im Hintergrund.
|
||||||
Für diese Prozesse muss der Pfad zu der PHP Version gesetzt sein, die verwendet werden soll.
|
Für diese Prozesse muss der Pfad zu der PHP Version gesetzt sein, die verwendet werden soll.
|
||||||
|
|
||||||
$a->config['php_path'] = '/pfad/zur/php-version';
|
[config]
|
||||||
|
php_path = {{$phpath}}
|
||||||
|
|
||||||
## Unterverzeichnis Konfiguration
|
## Unterverzeichnis Konfiguration
|
||||||
|
|
||||||
|
@ -382,9 +384,10 @@ Man kann Friendica in ein Unterverzeichnis des Webservers installieren.
|
||||||
Wir raten allerdings dringen davon ab, da es die Interoperabilität mit anderen Netzwerken (z.B. Diaspora, GNU Social, Hubzilla) verhindert.
|
Wir raten allerdings dringen davon ab, da es die Interoperabilität mit anderen Netzwerken (z.B. Diaspora, GNU Social, Hubzilla) verhindert.
|
||||||
Mal angenommen, du hast ein Unterverzeichnis tests und willst Friendica in ein weiteres Unterverzeichnis installieren, dann lautet die Konfiguration hierfür:
|
Mal angenommen, du hast ein Unterverzeichnis tests und willst Friendica in ein weiteres Unterverzeichnis installieren, dann lautet die Konfiguration hierfür:
|
||||||
|
|
||||||
$a->path = 'tests/friendica';
|
[system]
|
||||||
|
urlpath = tests/friendica
|
||||||
|
|
||||||
## Weitere Ausnahmen
|
## Weitere Ausnahmen
|
||||||
|
|
||||||
Es gibt noch einige experimentelle Einstellungen, die nur in der ``.htconfig.php`` Datei konfiguriert werden können.
|
Es gibt noch einige experimentelle Einstellungen, die nur in der ``config/local.ini.php`` Datei konfiguriert werden können.
|
||||||
Im [Konfigurationswerte, die nur in der .htconfig.php gesetzt werden können (EN)](help/htconfig) Artikel kannst du mehr darüber erfahren.
|
Im [Konfigurationswerte, die nur in der config/local.ini.php gesetzt werden können (EN)](help/Config) Artikel kannst du mehr darüber erfahren.
|
||||||
|
|
138
doc/htconfig.md
138
doc/htconfig.md
|
@ -1,138 +0,0 @@
|
||||||
Config values that can only be set in .htconfig.php
|
|
||||||
===================================================
|
|
||||||
|
|
||||||
* [Home](help)
|
|
||||||
|
|
||||||
There are some config values that haven't found their way into the administration page.
|
|
||||||
This has several reasons.
|
|
||||||
Maybe they are part of a current development that isn't considered stable and will be added later in the administration page when it is considered safe.
|
|
||||||
Or it triggers something that isn't expected to be of public interest.
|
|
||||||
Or it is for testing purposes only.
|
|
||||||
|
|
||||||
**Attention:** Please be warned that you shouldn't use one of these values without the knowledge what it could trigger.
|
|
||||||
Especially don't do that with undocumented values.
|
|
||||||
|
|
||||||
The header of the section describes the category, the value is the parameter.
|
|
||||||
Example: To set the automatic database cleanup process add this line to your .htconfig.php:
|
|
||||||
|
|
||||||
$a->config['system']['always_show_preview'] = true;
|
|
||||||
|
|
||||||
## jabber ##
|
|
||||||
* **debug** (Boolean) - Enable debug level for the jabber account synchronisation.
|
|
||||||
* **lockpath** - Must be writable by the ejabberd process. if set then it will prevent the running of multiple processes.
|
|
||||||
|
|
||||||
## system ##
|
|
||||||
|
|
||||||
* **allowed_link_protocols** (Array) - Allowed protocols in links URLs, add at your own risk. http is always allowed.
|
|
||||||
* **always_show_preview** (Boolean) - Only show small preview picures. Default value is false.
|
|
||||||
* **archival_days** (Integer) - Number of days that we try to deliver content before we archive a contact. Defaults to 32.
|
|
||||||
* **auth_cookie_lifetime** (Integer) - Number of days that should pass without any activity before a user who chose "Remember me" when logging in is considered logged out. Defaults to 7.
|
|
||||||
* **block_local_dir** (Boolean) - Blocks the access to the directory of the local users.
|
|
||||||
* **config_adapter** (jit|preload) - Allow to switch the configuration adapter to improve performances at the cost of memory consumption. Default value is "jit"
|
|
||||||
* **curl_range_bytes** - Maximum number of bytes that should be fetched. Default is 0, which mean "no limit".
|
|
||||||
* **db_log** - Name of a logfile to log slow database queries
|
|
||||||
* **db_loglimit** - If a database call lasts longer than this value it is logged
|
|
||||||
* **db_log_index** - Name of a logfile to log queries with bad indexes
|
|
||||||
* **db_log_index_watch** - Watchlist of indexes to watch
|
|
||||||
* **db_loglimit_index** - Number of index rows needed to be logged for indexes on the watchlist
|
|
||||||
* **db_loglimit_index_high** - Number of index rows to be logged anyway (for any index)
|
|
||||||
* **db_log_index_blacklist** - Blacklist of indexes that shouldn't be watched
|
|
||||||
* **dbclean_expire_conversation** (Integer) - When DBClean is enabled, any entry in the conversation table will be deleted after this many days. These data are normally needed only for debugging purposes and they are safe to delete. Default 90.
|
|
||||||
* **diaspora_test** (Boolean) - For development only. Disables the message transfer.
|
|
||||||
* **disable_email_validation** (Boolean) - Disables the check if a mail address is in a valid format and can be resolved via DNS.
|
|
||||||
* **disable_url_validation** (Boolean) - Disables the DNS lookup of an URL.
|
|
||||||
* **disable_password_exposed** (Boolean) - Disable the exposition check against the remote haveibeenpwned API on password change. Default value is false.
|
|
||||||
* **dlogfile** - location of the developer log file
|
|
||||||
* **dlogip** - restricts develop log writes to requests originating from this IP address
|
|
||||||
* **frontend_worker_timeout** - Value in minutes after we think that a frontend task was killed by the webserver. Default value is 10.
|
|
||||||
* **groupedit_image_limit** (Integer) - Number of contacts at which the group editor should switch from display the profile pictures of the contacts to only display the names. Default is 400. This can alternatively be set on a per account basis in the pconfig table.
|
|
||||||
* **hsts** (Boolean) - Enables the sending of HTTP Strict Transport Security headers
|
|
||||||
* **ignore_cache** (Boolean) - For development only. Disables the item cache.
|
|
||||||
* **instances_social_key** - Key to the API of https://instances.social which retrieves data about mastodon servers. See https://instances.social/api/token to get an API key.
|
|
||||||
* **ipv4_resolve** (Boolean) - Resolve IPV4 addresses only. Don't resolve to IPV6. Default value is false.
|
|
||||||
* **invitation_only** (Boolean) - If set true registration is only possible after a current member of the node has send an invitation. Default is false.
|
|
||||||
* **like_no_comment** (Boolean) - Don't update the "commented" value of an item when it is liked.
|
|
||||||
* **local_block** (Boolean) - Used in conjunction with "block_public".
|
|
||||||
* **local_search** (Boolean) - Blocks search for users who are not logged in to prevent crawlers from blocking your system.
|
|
||||||
* **local_tags** (Boolean) - If activated, all hashtags will point to the local server.
|
|
||||||
* **max_connections** - The maximum number of database connections which can be in use before the worker process is deferred to it's next interval. When the system can't detect the maximum numbers of connection then this value can be used.
|
|
||||||
* **max_connections_level** - The maximum level of connections that are allowed to let the worker start. It is a percentage value. Default value is 75.
|
|
||||||
* **max_contact_queue** - Default value is 500.
|
|
||||||
* **max_batch_queue** - Default value is 1000.
|
|
||||||
* **max_processes_backend** - Maximum number of concurrent database processes for background tasks. Default value is 5.
|
|
||||||
* **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20.
|
|
||||||
* **min_poll_interval** - minimal distance in minutes between two polls for a contact. Default is 1. Reasonable values are between 1 and 59.
|
|
||||||
* **session_handler** (database|cache|native) - Whether to use Cache to store session data or to use PHP native session storage. Default value is `database`.
|
|
||||||
* **cache_driver** (database|memcache|memcached) - Whether to use Memcache or Memcached to store temporary cache. Default value is `database`.
|
|
||||||
* **memcache_host** - Host name of the memcache daemon. Default is '127.0.0.1'.
|
|
||||||
* **memcache_port** - Port number of the memcache daemon. Default is 11211.
|
|
||||||
* **memcached_hosts** - Array of Memcached servers info `[host, port(, weight)]`. Default value is `[['127.0.0.1', 11211]]`.
|
|
||||||
* **no_count** (Boolean) - Don't do count calculations (currently only when showing albums)
|
|
||||||
* **no_oembed** (Boolean) - Don't use OEmbed to fetch more information about a link.
|
|
||||||
* **no_smilies** (Boolean) - Don't show smilies.
|
|
||||||
* **no_view_full_size** (Boolean) - Don't add the link "View full size" under a resized image.
|
|
||||||
* **optimize_items** (Boolean) - Triggers an SQL command to optimize the item table before expiring items.
|
|
||||||
* **ostatus_poll_timeframe** - Defines how old an item can be to try to complete the conversation with it.
|
|
||||||
* **paranoia** (Boolean) - Log out users if their IP address changed.
|
|
||||||
* **permit_crawling** (Boolean) - Restricts the search for not logged in users to one search per minute.
|
|
||||||
* **queue_no_dead_check** (Boolean) - Ignore if the target contact or server seems to be dead during queue delivery.
|
|
||||||
* **worker_debug** (Boolean) - If enabled, it prints out the number of running processes split by priority.
|
|
||||||
* **worker_fetch_limit** - Number of worker tasks that are fetched in a single query. Default is 1.
|
|
||||||
* **profiler** (Boolean) - Enable internal timings to help optimize code. Needed for "rendertime" addon. Default is false.
|
|
||||||
* **free_crawls** - Number of "free" searches when "permit_crawling" is activated (Default value is 10)
|
|
||||||
* **crawl_permit_period** - Period in seconds between allowed searches when the number of free searches is reached and "permit_crawling" is activated (Default value is 60)
|
|
||||||
* **png_quality** - Default value is 8.
|
|
||||||
* **proc_windows** (Boolean) - Should be enabled if Friendica is running under Windows.
|
|
||||||
* **proxy_cache_time** - Time after which the cache is cleared. Default value is one day.
|
|
||||||
* **pushpoll_frequency** -
|
|
||||||
* **qsearch_limit** - Default value is 100.
|
|
||||||
* **remove_multiplicated_lines** (Boolean) - If enabled, multiple linefeeds in items are stripped to a single one.
|
|
||||||
* **sendmail_params** (Boolean) - Normal sendmail command parameters will be added when the PHP mail() function is called for sending e-mails. This ensures the Sender Email address setting is applied to the message envelope rather than the host's default address. Default is true. Set to false if your non-sendmail agent is incompatible, or to restore old behavior of using the host address.
|
|
||||||
* **show_unsupported_addons** (Boolean) - Show all addons including the unsupported ones.
|
|
||||||
* **show_unsupported_themes** (Boolean) - Show all themes including the unsupported ones.
|
|
||||||
* **show_global_community_hint** (Boolean) - When the global community page is enabled, use this option to display a hint above the stream, that this is a collection of all public top-level postings that arrive on your node.
|
|
||||||
* **throttle_limit_day** - Maximum number of posts that a user can send per day with the API.
|
|
||||||
* **throttle_limit_week** - Maximum number of posts that a user can send per week with the API.
|
|
||||||
* **throttle_limit_month** - Maximum number of posts that a user can send per month with the API.
|
|
||||||
* **wall-to-wall_share** (Boolean) - Displays forwarded posts like "wall-to-wall" posts.
|
|
||||||
* **worker_cooldown** - Cooldown time after each worker function call. Default value is 0 seconds.
|
|
||||||
* **worker_load_exponent** (Integer) - Default 3, which allows only 25% of the maximum worker queues when server load reaches around 37% of maximum load. For a linear response where 25% of worker queues are allowed at 75% of maximum load, set this to 1. Setting 0 would allow maximum worker queues at all times, which is not recommended.
|
|
||||||
* **xrd_timeout** - Timeout for fetching the XRD links. Default value is 20 seconds.
|
|
||||||
|
|
||||||
## experimental ##
|
|
||||||
|
|
||||||
* **exp_themes** (Boolean) - Show experimental themes as well.
|
|
||||||
|
|
||||||
## theme ##
|
|
||||||
|
|
||||||
* **hide_eventlist** (Boolean) - Don't show the birthdays and events on the profile and network page
|
|
||||||
|
|
||||||
# Administrator Options #
|
|
||||||
|
|
||||||
Enabling the admin panel for an account, and thus making the account holder admin of the node, is done by setting the variable
|
|
||||||
|
|
||||||
$a->config['admin_email'] = "someone@example.com";
|
|
||||||
|
|
||||||
Where you have to match the email address used for the account with the one you enter to the .htconfig file.
|
|
||||||
If more then one account should be able to access the admin panel, seperate the email addresses with a comma.
|
|
||||||
|
|
||||||
$a->config['admin_email'] = "someone@example.com,someonelese@example.com";
|
|
||||||
|
|
||||||
If you want to have a more personalized closing line for the notification emails you can set a variable for the admin_name.
|
|
||||||
|
|
||||||
$a->config['admin_name'] = "Marvin";
|
|
||||||
|
|
||||||
## Database Settings
|
|
||||||
|
|
||||||
The configuration variables db_host, db_user, db_pass and db_data are holding your credentials for the database connection.
|
|
||||||
If you need to specify a port to access the database, you can do so by appending ":portnumber" to the db_host variable.
|
|
||||||
|
|
||||||
$db_host = 'your.mysqlhost.com:123456';
|
|
||||||
|
|
||||||
If all of the following environment variables are set, Friendica will use them instead of the previously configured variables for the db:
|
|
||||||
|
|
||||||
MYSQL_HOST
|
|
||||||
MYSQL_PORT
|
|
||||||
MYSQL_USERNAME
|
|
||||||
MYSQL_PASSWORD
|
|
||||||
MYSQL_DATABASE
|
|
114
htconfig.php
114
htconfig.php
|
@ -1,114 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
// If automatic system installation fails:
|
|
||||||
|
|
||||||
|
|
||||||
die('The configuration you did manually contains some mistakes. Please have a look at your .htconfig.php file.');
|
|
||||||
// If you are doing the configuration manually, please remove the line above
|
|
||||||
|
|
||||||
|
|
||||||
// Copy or rename this file to .htconfig.php
|
|
||||||
|
|
||||||
// Why .htconfig.php? Because it contains sensitive information which could
|
|
||||||
// give somebody complete control of your database. Apache's default
|
|
||||||
// configuration denies access to and refuses to serve any file beginning
|
|
||||||
// with .ht
|
|
||||||
|
|
||||||
// Then set the following for your MySQL installation
|
|
||||||
|
|
||||||
$db_host = 'your.mysqlhost.com';
|
|
||||||
$db_user = 'mysqlusername';
|
|
||||||
$db_pass = 'mysqlpassword';
|
|
||||||
$db_data = 'mysqldatabasename';
|
|
||||||
|
|
||||||
// Use environment variables for mysql if they are set beforehand
|
|
||||||
if (!empty(getenv('MYSQL_HOST'))
|
|
||||||
&& (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER')))
|
|
||||||
&& !getenv('MYSQL_PASSWORD') === false
|
|
||||||
&& !empty(getenv('MYSQL_DATABASE'))) {
|
|
||||||
$db_host = getenv('MYSQL_HOST');
|
|
||||||
if (!empty(getenv('MYSQL_PORT'))) {
|
|
||||||
$db_host .= ':' . getenv('MYSQL_PORT');
|
|
||||||
}
|
|
||||||
if (!empty(getenv('MYSQL_USERNAME'))) {
|
|
||||||
$db_user = getenv('MYSQL_USERNAME');
|
|
||||||
} else {
|
|
||||||
$db_user = getenv('MYSQL_USER');
|
|
||||||
}
|
|
||||||
$db_pass = (string) getenv('MYSQL_PASSWORD');
|
|
||||||
$db_data = getenv('MYSQL_DATABASE');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the database connection charset to full Unicode (utf8mb4).
|
|
||||||
// Changing this value will likely corrupt the special characters.
|
|
||||||
// You have been warned.
|
|
||||||
$a->config['system']['db_charset'] = "utf8mb4";
|
|
||||||
|
|
||||||
// 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 = 'America/Los_Angeles';
|
|
||||||
|
|
||||||
// Default system language
|
|
||||||
|
|
||||||
$a->config['system']['language'] = 'en';
|
|
||||||
|
|
||||||
// What is your site name?
|
|
||||||
|
|
||||||
$a->config['sitename'] = "Friendica Social Network";
|
|
||||||
|
|
||||||
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
|
|
||||||
// Be certain to create your own personal account before setting
|
|
||||||
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
|
|
||||||
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
|
|
||||||
// to the email address of an already registered person who can authorise
|
|
||||||
// and/or approve/deny the request.
|
|
||||||
|
|
||||||
// In order to perform system administration via the admin panel, admin_email
|
|
||||||
// must precisely match the email address of the person logged in.
|
|
||||||
|
|
||||||
$a->config['register_policy'] = REGISTER_OPEN;
|
|
||||||
$a->config['register_text'] = '';
|
|
||||||
$a->config['admin_email'] = '';
|
|
||||||
|
|
||||||
// Maximum size of an imported message, 0 is unlimited
|
|
||||||
|
|
||||||
$a->config['max_import_size'] = 200000;
|
|
||||||
|
|
||||||
// maximum size of uploaded photos
|
|
||||||
|
|
||||||
$a->config['system']['maximagesize'] = 800000;
|
|
||||||
|
|
||||||
// Location of PHP command line processor
|
|
||||||
|
|
||||||
$a->config['php_path'] = 'php';
|
|
||||||
|
|
||||||
// Server-to-server private message encryption (RINO) is allowed by default.
|
|
||||||
// set to 0 to disable, 1 to enable
|
|
||||||
|
|
||||||
$a->config['system']['rino_encrypt'] = 1;
|
|
||||||
|
|
||||||
// allowed themes (change this from admin panel after installation)
|
|
||||||
|
|
||||||
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
|
|
||||||
|
|
||||||
// default system theme
|
|
||||||
|
|
||||||
$a->config['system']['theme'] = 'vier';
|
|
||||||
|
|
||||||
|
|
||||||
// By default allow pseudonyms
|
|
||||||
|
|
||||||
$a->config['system']['no_regfullname'] = true;
|
|
||||||
|
|
||||||
//Deny public access to the local directory
|
|
||||||
//$a->config['system']['block_local_dir'] = false;
|
|
||||||
|
|
||||||
// Location of the global directory
|
|
||||||
$a->config['system']['directory'] = 'https://dir.friendica.social';
|
|
||||||
|
|
||||||
// Allowed protocols in link URLs; HTTP protocols always are accepted
|
|
||||||
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
|
|
||||||
|
|
||||||
// Authentication cookie lifetime, in days
|
|
||||||
$a->config['system']['auth_cookie_lifetime'] = 7;
|
|
|
@ -772,6 +772,7 @@ function api_get_user(App $a, $contact_id = null)
|
||||||
$theme_info = dba::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
|
$theme_info = dba::selectFirst('user', ['theme'], ['uid' => $ret['uid']]);
|
||||||
if ($theme_info['theme'] === 'frio') {
|
if ($theme_info['theme'] === 'frio') {
|
||||||
$schema = PConfig::get($ret['uid'], 'frio', 'schema');
|
$schema = PConfig::get($ret['uid'], 'frio', 'schema');
|
||||||
|
|
||||||
if ($schema && ($schema != '---')) {
|
if ($schema && ($schema != '---')) {
|
||||||
if (file_exists('view/theme/frio/schema/'.$schema.'.php')) {
|
if (file_exists('view/theme/frio/schema/'.$schema.'.php')) {
|
||||||
$schemefile = 'view/theme/frio/schema/'.$schema.'.php';
|
$schemefile = 'view/theme/frio/schema/'.$schema.'.php';
|
||||||
|
@ -3344,7 +3345,7 @@ function api_statusnet_config($type)
|
||||||
$server = $a->get_hostname();
|
$server = $a->get_hostname();
|
||||||
$logo = System::baseUrl() . '/images/friendica-64.png';
|
$logo = System::baseUrl() . '/images/friendica-64.png';
|
||||||
$email = Config::get('config', 'admin_email');
|
$email = Config::get('config', 'admin_email');
|
||||||
$closed = Config::get('config', 'register_policy') == REGISTER_CLOSED ? 'true' : 'false';
|
$closed = intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 'true' : 'false';
|
||||||
$private = Config::get('system', 'block_public') ? 'true' : 'false';
|
$private = Config::get('system', 'block_public') ? 'true' : 'false';
|
||||||
$textlimit = (string) Config::get('config', 'api_import_size', Config::get('config', 'max_import_size', 200000));
|
$textlimit = (string) Config::get('config', 'api_import_size', Config::get('config', 'max_import_size', 200000));
|
||||||
$ssl = Config::get('system', 'have_ssl') ? 'true' : 'false';
|
$ssl = Config::get('system', 'have_ssl') ? 'true' : 'false';
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Friendica\App;
|
// Do not use Core\Config in this class at risk of infinite loop.
|
||||||
use Friendica\Core\L10n;
|
// Please use App->getConfigVariable() instead.
|
||||||
|
//use Friendica\Core\Config;
|
||||||
|
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
use Friendica\Database\DBStructure;
|
use Friendica\Database\DBStructure;
|
||||||
|
@ -29,21 +31,20 @@ class dba {
|
||||||
private static $db_user = '';
|
private static $db_user = '';
|
||||||
private static $db_pass = '';
|
private static $db_pass = '';
|
||||||
private static $db_name = '';
|
private static $db_name = '';
|
||||||
|
private static $db_charset = '';
|
||||||
|
|
||||||
public static function connect($serveraddr, $user, $pass, $db) {
|
public static function connect($serveraddr, $user, $pass, $db, $charset = null)
|
||||||
|
{
|
||||||
if (!is_null(self::$db) && self::connected()) {
|
if (!is_null(self::$db) && self::connected()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
|
|
||||||
// We are storing these values for being able to perform a reconnect
|
// We are storing these values for being able to perform a reconnect
|
||||||
self::$db_serveraddr = $serveraddr;
|
self::$db_serveraddr = $serveraddr;
|
||||||
self::$db_user = $user;
|
self::$db_user = $user;
|
||||||
self::$db_pass = $pass;
|
self::$db_pass = $pass;
|
||||||
self::$db_name = $db;
|
self::$db_name = $db;
|
||||||
|
self::$db_charset = $charset;
|
||||||
|
|
||||||
$serveraddr = trim($serveraddr);
|
$serveraddr = trim($serveraddr);
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ class dba {
|
||||||
$user = trim($user);
|
$user = trim($user);
|
||||||
$pass = trim($pass);
|
$pass = trim($pass);
|
||||||
$db = trim($db);
|
$db = trim($db);
|
||||||
|
$charset = trim($charset);
|
||||||
|
|
||||||
if (!(strlen($server) && strlen($user))) {
|
if (!(strlen($server) && strlen($user))) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -71,9 +73,10 @@ class dba {
|
||||||
$connect .= ";port=".$port;
|
$connect .= ";port=".$port;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($a->config["system"]["db_charset"])) {
|
if ($charset) {
|
||||||
$connect .= ";charset=".$a->config["system"]["db_charset"];
|
$connect .= ";charset=".$charset;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
self::$db = @new PDO($connect, $user, $pass);
|
self::$db = @new PDO($connect, $user, $pass);
|
||||||
self::$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
self::$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
|
||||||
|
@ -88,8 +91,8 @@ class dba {
|
||||||
if (!mysqli_connect_errno()) {
|
if (!mysqli_connect_errno()) {
|
||||||
self::$connected = true;
|
self::$connected = true;
|
||||||
|
|
||||||
if (isset($a->config["system"]["db_charset"])) {
|
if ($charset) {
|
||||||
self::$db->set_charset($a->config["system"]["db_charset"]);
|
self::$db->set_charset($charset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +102,6 @@ class dba {
|
||||||
self::$driver = null;
|
self::$driver = null;
|
||||||
self::$db = null;
|
self::$db = null;
|
||||||
}
|
}
|
||||||
$a->save_timestamp($stamp1, "network");
|
|
||||||
|
|
||||||
return self::$connected;
|
return self::$connected;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +132,7 @@ class dba {
|
||||||
public static function reconnect() {
|
public static function reconnect() {
|
||||||
self::disconnect();
|
self::disconnect();
|
||||||
|
|
||||||
$ret = self::connect(self::$db_serveraddr, self::$db_user, self::$db_pass, self::$db_name);
|
$ret = self::connect(self::$db_serveraddr, self::$db_user, self::$db_pass, self::$db_name, self::$db_charset);
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +186,7 @@ class dba {
|
||||||
private static function logIndex($query) {
|
private static function logIndex($query) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
if (empty($a->config["system"]["db_log_index"])) {
|
if (!$a->getConfigVariable('system', 'db_log_index')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,18 +205,18 @@ class dba {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$watchlist = explode(',', $a->config["system"]["db_log_index_watch"]);
|
$watchlist = explode(',', $a->getConfigVariable('system', 'db_log_index_watch'));
|
||||||
$blacklist = explode(',', $a->config["system"]["db_log_index_blacklist"]);
|
$blacklist = explode(',', $a->getConfigVariable('system', 'db_log_index_blacklist'));
|
||||||
|
|
||||||
while ($row = dba::fetch($r)) {
|
while ($row = dba::fetch($r)) {
|
||||||
if ((intval($a->config["system"]["db_loglimit_index"]) > 0)) {
|
if ((intval($a->getConfigVariable('system', 'db_loglimit_index')) > 0)) {
|
||||||
$log = (in_array($row['key'], $watchlist) &&
|
$log = (in_array($row['key'], $watchlist) &&
|
||||||
($row['rows'] >= intval($a->config["system"]["db_loglimit_index"])));
|
($row['rows'] >= intval($a->getConfigVariable('system', 'db_loglimit_index'))));
|
||||||
} else {
|
} else {
|
||||||
$log = false;
|
$log = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) && ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
|
if ((intval($a->getConfigVariable('system', 'db_loglimit_index_high')) > 0) && ($row['rows'] >= intval($a->getConfigVariable('system', 'db_loglimit_index_high')))) {
|
||||||
$log = true;
|
$log = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +226,7 @@ class dba {
|
||||||
|
|
||||||
if ($log) {
|
if ($log) {
|
||||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
@file_put_contents($a->config["system"]["db_log_index"], DateTimeFormat::utcNow()."\t".
|
@file_put_contents($a->getConfigVariable('system', 'db_log_index'), DateTimeFormat::utcNow()."\t".
|
||||||
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
|
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
|
||||||
basename($backtrace[1]["file"])."\t".
|
basename($backtrace[1]["file"])."\t".
|
||||||
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
||||||
|
@ -384,7 +386,7 @@ class dba {
|
||||||
|
|
||||||
$orig_sql = $sql;
|
$orig_sql = $sql;
|
||||||
|
|
||||||
if (x($a->config,'system') && x($a->config['system'], 'db_callstack')) {
|
if ($a->getConfigValue('system', 'db_callstack')) {
|
||||||
$sql = "/*".System::callstack()." */ ".$sql;
|
$sql = "/*".System::callstack()." */ ".$sql;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,16 +547,15 @@ class dba {
|
||||||
|
|
||||||
$a->save_timestamp($stamp1, 'database');
|
$a->save_timestamp($stamp1, 'database');
|
||||||
|
|
||||||
if (x($a->config,'system') && x($a->config['system'], 'db_log')) {
|
if ($a->getConfigValue('system', 'db_log')) {
|
||||||
|
|
||||||
$stamp2 = microtime(true);
|
$stamp2 = microtime(true);
|
||||||
$duration = (float)($stamp2 - $stamp1);
|
$duration = (float)($stamp2 - $stamp1);
|
||||||
|
|
||||||
if (($duration > $a->config["system"]["db_loglimit"])) {
|
if (($duration > $a->getConfigValue('system', 'db_loglimit'))) {
|
||||||
$duration = round($duration, 3);
|
$duration = round($duration, 3);
|
||||||
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
|
||||||
|
|
||||||
@file_put_contents($a->config["system"]["db_log"], DateTimeFormat::utcNow()."\t".$duration."\t".
|
@file_put_contents($a->getConfigValue('system', 'db_log'), DateTimeFormat::utcNow()."\t".$duration."\t".
|
||||||
basename($backtrace[1]["file"])."\t".
|
basename($backtrace[1]["file"])."\t".
|
||||||
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
|
||||||
substr(self::replaceParameters($sql, $args), 0, 2000)."\n", FILE_APPEND);
|
substr(self::replaceParameters($sql, $args), 0, 2000)."\n", FILE_APPEND);
|
||||||
|
@ -1377,7 +1378,7 @@ class dba {
|
||||||
$is_alpha = true;
|
$is_alpha = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($is_int && $is_alpha) {
|
if ($is_int && $is_alpha) {
|
||||||
foreach ($value as &$ref) {
|
foreach ($value as &$ref) {
|
||||||
if (is_int($ref)) {
|
if (is_int($ref)) {
|
||||||
|
|
|
@ -33,11 +33,11 @@ function notification($params)
|
||||||
$product = FRIENDICA_PLATFORM;
|
$product = FRIENDICA_PLATFORM;
|
||||||
$siteurl = System::baseUrl(true);
|
$siteurl = System::baseUrl(true);
|
||||||
$thanks = L10n::t('Thank You,');
|
$thanks = L10n::t('Thank You,');
|
||||||
$sitename = $a->config['sitename'];
|
$sitename = Config::get('config', 'sitename');
|
||||||
if (empty($a->config['admin_name'])) {
|
if (Config::get('config', 'admin_name')) {
|
||||||
$site_admin = L10n::t('%s Administrator', $sitename);
|
$site_admin = L10n::t('%1$s, %2$s Administrator', Config::get('config', 'admin_name'), $sitename);
|
||||||
} else {
|
} else {
|
||||||
$site_admin = L10n::t('%1$s, %2$s Administrator', $a->config['admin_name'], $sitename);
|
$site_admin = L10n::t('%s Administrator', $sitename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sender_name = $sitename;
|
$sender_name = $sitename;
|
||||||
|
|
107
include/text.php
107
include/text.php
|
@ -462,86 +462,6 @@ function perms2str($p) {
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated
|
|
||||||
* wrapper to load a view template, checking for alternate
|
|
||||||
* languages before falling back to the default
|
|
||||||
*
|
|
||||||
* @global string $lang
|
|
||||||
* @global App $a
|
|
||||||
* @param string $s view name
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function load_view_file($s) {
|
|
||||||
global $lang, $a;
|
|
||||||
if (!isset($lang)) {
|
|
||||||
$lang = 'en';
|
|
||||||
}
|
|
||||||
$b = basename($s);
|
|
||||||
$d = dirname($s);
|
|
||||||
if (file_exists("$d/$lang/$b")) {
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
$content = file_get_contents("$d/$lang/$b");
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
$theme = $a->getCurrentTheme();
|
|
||||||
|
|
||||||
if (file_exists("$d/theme/$theme/$b")) {
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
$content = file_get_contents("$d/theme/$theme/$b");
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
$content = file_get_contents($s);
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* load a view template, checking for alternate
|
|
||||||
* languages before falling back to the default
|
|
||||||
*
|
|
||||||
* @global string $lang
|
|
||||||
* @param string $s view path
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
function get_intltext_template($s) {
|
|
||||||
global $lang;
|
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
$engine = '';
|
|
||||||
if ($a->theme['template_engine'] === 'smarty3') {
|
|
||||||
$engine = "/smarty3";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isset($lang)) {
|
|
||||||
$lang = 'en';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists("view/lang/$lang$engine/$s")) {
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
$content = file_get_contents("view/lang/$lang$engine/$s");
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
|
||||||
return $content;
|
|
||||||
} elseif (file_exists("view/lang/en$engine/$s")) {
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
$content = file_get_contents("view/lang/en$engine/$s");
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
|
||||||
return $content;
|
|
||||||
} else {
|
|
||||||
$stamp1 = microtime(true);
|
|
||||||
$content = file_get_contents("view$engine/$s");
|
|
||||||
$a->save_timestamp($stamp1, "file");
|
|
||||||
return $content;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* load template $s
|
* load template $s
|
||||||
*
|
*
|
||||||
|
@ -599,7 +519,6 @@ $LOGGER_LEVELS = [];
|
||||||
* LOGGER_DATA
|
* LOGGER_DATA
|
||||||
* LOGGER_ALL
|
* LOGGER_ALL
|
||||||
*
|
*
|
||||||
* @global App $a
|
|
||||||
* @global array $LOGGER_LEVELS
|
* @global array $LOGGER_LEVELS
|
||||||
* @param string $msg
|
* @param string $msg
|
||||||
* @param int $level
|
* @param int $level
|
||||||
|
@ -608,17 +527,9 @@ function logger($msg, $level = 0) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
global $LOGGER_LEVELS;
|
global $LOGGER_LEVELS;
|
||||||
|
|
||||||
// turn off logger in install mode
|
$debugging = Config::get('system', 'debugging');
|
||||||
if (
|
$logfile = Config::get('system', 'logfile');
|
||||||
$a->mode == App::MODE_INSTALL
|
$loglevel = intval(Config::get('system', 'loglevel'));
|
||||||
|| !dba::$connected
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$debugging = Config::get('system','debugging');
|
|
||||||
$logfile = Config::get('system','logfile');
|
|
||||||
$loglevel = intval(Config::get('system','loglevel'));
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!$debugging
|
!$debugging
|
||||||
|
@ -678,23 +589,13 @@ function logger($msg, $level = 0) {
|
||||||
* LOGGER_DATA
|
* LOGGER_DATA
|
||||||
* LOGGER_ALL
|
* LOGGER_ALL
|
||||||
*
|
*
|
||||||
* @global App $a
|
|
||||||
* @global array $LOGGER_LEVELS
|
* @global array $LOGGER_LEVELS
|
||||||
* @param string $msg
|
* @param string $msg
|
||||||
* @param int $level
|
* @param int $level
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function dlogger($msg, $level = 0) {
|
function dlogger($msg, $level = 0) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
// turn off logger in install mode
|
|
||||||
if (
|
|
||||||
$a->mode == App::MODE_INSTALL
|
|
||||||
|| !dba::$connected
|
|
||||||
) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$logfile = Config::get('system', 'dlogfile');
|
$logfile = Config::get('system', 'dlogfile');
|
||||||
if (!$logfile) {
|
if (!$logfile) {
|
||||||
return;
|
return;
|
||||||
|
@ -716,7 +617,7 @@ function dlogger($msg, $level = 0) {
|
||||||
$process_id = session_id();
|
$process_id = session_id();
|
||||||
|
|
||||||
if ($process_id == '') {
|
if ($process_id == '') {
|
||||||
$process_id = get_app()->process_id;
|
$process_id = $a->process_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$callers = debug_backtrace();
|
$callers = debug_backtrace();
|
||||||
|
|
42
index.php
42
index.php
|
@ -9,7 +9,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseObject;
|
|
||||||
use Friendica\Content\Nav;
|
use Friendica\Content\Nav;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
@ -25,44 +24,31 @@ use Friendica\Module\Login;
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
|
|
||||||
$a = new App(__DIR__);
|
$a = new App(__DIR__);
|
||||||
BaseObject::setApp($a);
|
|
||||||
|
|
||||||
// We assume that the index.php is called by a frontend process
|
// We assume that the index.php is called by a frontend process
|
||||||
// The value is set to "true" by default in boot.php
|
// The value is set to "true" by default in boot.php
|
||||||
$a->backend = false;
|
$a->backend = false;
|
||||||
|
|
||||||
// Only load config if found, don't suppress errors
|
|
||||||
if (!$a->mode == App::MODE_INSTALL) {
|
|
||||||
include ".htconfig.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to open the database;
|
* Try to open the database;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once "include/dba.php";
|
require_once "include/dba.php";
|
||||||
|
|
||||||
if (!$a->mode == App::MODE_INSTALL) {
|
// Missing DB connection: ERROR
|
||||||
$result = dba::connect($db_host, $db_user, $db_pass, $db_data);
|
if ($a->mode & App::MODE_LOCALCONFIGPRESENT && !($a->mode & App::MODE_DBAVAILABLE)) {
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
System::httpExit(500, ['title' => 'Error 500 - Internal Server Error', 'description' => 'Apologies but the website is unavailable at the moment.']);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$result) {
|
// Max Load Average reached: ERROR
|
||||||
System::unavailable();
|
if ($a->isMaxProcessesReached() || $a->isMaxLoadReached()) {
|
||||||
}
|
header('Retry-After: 120');
|
||||||
|
header('Refresh: 120; url=' . System::baseUrl() . "/" . $a->query_string);
|
||||||
|
|
||||||
/**
|
System::httpExit(503, ['title' => 'Error 503 - Service Temporarily Unavailable', 'description' => 'System is currently overloaded. Please try again later.']);
|
||||||
* Load configs from db. Overwrite configs from .htconfig.php
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
Config::load();
|
|
||||||
|
|
||||||
if ($a->max_processes_reached() || $a->maxload_reached()) {
|
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 503 Service Temporarily Unavailable');
|
|
||||||
header('Retry-After: 120');
|
|
||||||
header('Refresh: 120; url=' . System::baseUrl() . "/" . $a->query_string);
|
|
||||||
die("System is currently unavailable. Please try again later");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ($a->isInstallMode()) {
|
||||||
if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
|
if (Config::get('system', 'force_ssl') && ($a->get_scheme() == "http")
|
||||||
&& (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
|
&& (intval(Config::get('system', 'ssl_policy')) == SSL_POLICY_FULL)
|
||||||
&& (substr(System::baseUrl(), 0, 8) == "https://")
|
&& (substr(System::baseUrl(), 0, 8) == "https://")
|
||||||
|
@ -76,8 +62,6 @@ if (!$a->mode == App::MODE_INSTALL) {
|
||||||
Session::init();
|
Session::init();
|
||||||
Addon::loadHooks();
|
Addon::loadHooks();
|
||||||
Addon::callHooks('init_1');
|
Addon::callHooks('init_1');
|
||||||
|
|
||||||
$a->checkMaintenanceMode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang = L10n::getBrowserLanguage();
|
$lang = L10n::getBrowserLanguage();
|
||||||
|
@ -183,9 +167,9 @@ $_SESSION['last_updated'] = defaults($_SESSION, 'last_updated', []);
|
||||||
|
|
||||||
// in install mode, any url loads install module
|
// in install mode, any url loads install module
|
||||||
// but we need "view" module for stylesheet
|
// but we need "view" module for stylesheet
|
||||||
if ($a->mode == App::MODE_INSTALL && $a->module!="view") {
|
if ($a->isInstallMode() && $a->module!="view") {
|
||||||
$a->module = 'install';
|
$a->module = 'install';
|
||||||
} elseif ($a->mode == App::MODE_MAINTENANCE && $a->module!="view") {
|
} elseif (!($a->mode & App::MODE_MAINTENANCEDISABLED) && $a->module != "view") {
|
||||||
$a->module = 'maintenance';
|
$a->module = 'maintenance';
|
||||||
} else {
|
} else {
|
||||||
check_url($a);
|
check_url($a);
|
||||||
|
|
|
@ -845,6 +845,12 @@ function admin_page_summary(App $a)
|
||||||
$warningtext[] = L10n::t('The last worker execution was on %s UTC. This is older than one hour. Please check your crontab settings.', $last_worker_call);
|
$warningtext[] = L10n::t('The last worker execution was on %s UTC. This is older than one hour. Please check your crontab settings.', $last_worker_call);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Legacy config file warning
|
||||||
|
if (file_exists('.htconfig.php')) {
|
||||||
|
$showwarning = true;
|
||||||
|
$warningtext[] = L10n::t('Friendica\'s configuration now is stored in config/local.ini.php, please copy config/local-sample.ini.php and move your config from <code>.htconfig.php</code>. See <a href="%s">the Config help page</a> for help with the transition.', $a->get_baseurl() . '/help/Config');
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
|
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
|
||||||
$accounts = [
|
$accounts = [
|
||||||
[L10n::t('Normal Account'), 0],
|
[L10n::t('Normal Account'), 0],
|
||||||
|
@ -938,8 +944,6 @@ function admin_page_site_post(App $a)
|
||||||
|
|
||||||
function update_table($table_name, $fields, $old_url, $new_url)
|
function update_table($table_name, $fields, $old_url, $new_url)
|
||||||
{
|
{
|
||||||
global $a;
|
|
||||||
|
|
||||||
$dbold = dbesc($old_url);
|
$dbold = dbesc($old_url);
|
||||||
$dbnew = dbesc($new_url);
|
$dbnew = dbesc($new_url);
|
||||||
|
|
||||||
|
@ -1378,8 +1382,8 @@ function admin_page_site(App $a)
|
||||||
"develop" => L10n::t("check the development version")
|
"develop" => L10n::t("check the development version")
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($a->config['hostname'] == "") {
|
if (empty(Config::get('config', 'hostname'))) {
|
||||||
$a->config['hostname'] = $a->get_hostname();
|
Config::set('config', 'hostname', $a->get_hostname());
|
||||||
}
|
}
|
||||||
$diaspora_able = ($a->get_path() == "");
|
$diaspora_able = ($a->get_path() == "");
|
||||||
|
|
||||||
|
@ -1388,8 +1392,6 @@ function admin_page_site(App $a)
|
||||||
if ($optimize_max_tablesize <= 0) {
|
if ($optimize_max_tablesize <= 0) {
|
||||||
$optimize_max_tablesize = -1;
|
$optimize_max_tablesize = -1;
|
||||||
}
|
}
|
||||||
// Default list of forbidden names, classic role names from RFC 2142
|
|
||||||
$default_forbidden_nicknames = 'info, marketing, sales, support, abuse, noc, security, postmaster, hostmaster, usenet, news, webmaster, www, uucp, ftp, root, sysop';
|
|
||||||
|
|
||||||
$t = get_markup_template('admin/site.tpl');
|
$t = get_markup_template('admin/site.tpl');
|
||||||
return replace_macros($t, [
|
return replace_macros($t, [
|
||||||
|
@ -1408,9 +1410,9 @@ function admin_page_site(App $a)
|
||||||
'$relocate' => L10n::t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
|
'$relocate' => L10n::t('Relocate - WARNING: advanced function. Could make this server unreachable.'),
|
||||||
'$baseurl' => System::baseUrl(true),
|
'$baseurl' => System::baseUrl(true),
|
||||||
// name, label, value, help string, extra data...
|
// name, label, value, help string, extra data...
|
||||||
'$sitename' => ['sitename', L10n::t("Site name"), $a->config['sitename'],''],
|
'$sitename' => ['sitename', L10n::t("Site name"), Config::get('config', 'sitename'),''],
|
||||||
'$hostname' => ['hostname', L10n::t("Host name"), $a->config['hostname'], ""],
|
'$hostname' => ['hostname', L10n::t("Host name"), Config::get('config', 'hostname'), ""],
|
||||||
'$sender_email' => ['sender_email', L10n::t("Sender Email"), $a->config['sender_email'], L10n::t("The email address your server shall use to send notification emails from."), "", "", "email"],
|
'$sender_email' => ['sender_email', L10n::t("Sender Email"), Config::get('config', 'sender_email'), L10n::t("The email address your server shall use to send notification emails from."), "", "", "email"],
|
||||||
'$banner' => ['banner', L10n::t("Banner/Logo"), $banner, ""],
|
'$banner' => ['banner', L10n::t("Banner/Logo"), $banner, ""],
|
||||||
'$shortcut_icon' => ['shortcut_icon', L10n::t("Shortcut icon"), Config::get('system','shortcut_icon'), L10n::t("Link to an icon that will be used for browsers.")],
|
'$shortcut_icon' => ['shortcut_icon', L10n::t("Shortcut icon"), Config::get('system','shortcut_icon'), L10n::t("Link to an icon that will be used for browsers.")],
|
||||||
'$touch_icon' => ['touch_icon', L10n::t("Touch icon"), Config::get('system','touch_icon'), L10n::t("Link to an icon that will be used for tablets and mobiles.")],
|
'$touch_icon' => ['touch_icon', L10n::t("Touch icon"), Config::get('system','touch_icon'), L10n::t("Link to an icon that will be used for tablets and mobiles.")],
|
||||||
|
@ -1426,10 +1428,10 @@ function admin_page_site(App $a)
|
||||||
'$maximagelength' => ['maximagelength', L10n::t("Maximum image length"), Config::get('system','max_image_length'), L10n::t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")],
|
'$maximagelength' => ['maximagelength', L10n::t("Maximum image length"), Config::get('system','max_image_length'), L10n::t("Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.")],
|
||||||
'$jpegimagequality' => ['jpegimagequality', L10n::t("JPEG image quality"), Config::get('system','jpeg_quality'), L10n::t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")],
|
'$jpegimagequality' => ['jpegimagequality', L10n::t("JPEG image quality"), Config::get('system','jpeg_quality'), L10n::t("Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.")],
|
||||||
|
|
||||||
'$register_policy' => ['register_policy', L10n::t("Register policy"), $a->config['register_policy'], "", $register_choices],
|
'$register_policy' => ['register_policy', L10n::t("Register policy"), Config::get('config', 'register_policy'), "", $register_choices],
|
||||||
'$daily_registrations' => ['max_daily_registrations', L10n::t("Maximum Daily Registrations"), Config::get('system', 'max_daily_registrations'), L10n::t("If registration is permitted above, this sets the maximum number of new user registrations to accept per day. If register is set to closed, this setting has no effect.")],
|
'$daily_registrations' => ['max_daily_registrations', L10n::t("Maximum Daily Registrations"), Config::get('system', 'max_daily_registrations'), L10n::t("If registration is permitted above, this sets the maximum number of new user registrations to accept per day. If register is set to closed, this setting has no effect.")],
|
||||||
'$register_text' => ['register_text', L10n::t("Register text"), $a->config['register_text'], L10n::t("Will be displayed prominently on the registration page. You can use BBCode here.")],
|
'$register_text' => ['register_text', L10n::t("Register text"), Config::get('config', 'register_text'), L10n::t("Will be displayed prominently on the registration page. You can use BBCode here.")],
|
||||||
'$forbidden_nicknames' => ['forbidden_nicknames', L10n::t('Forbidden Nicknames'), Config::get('system', 'forbidden_nicknames', $default_forbidden_nicknames), L10n::t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
|
'$forbidden_nicknames' => ['forbidden_nicknames', L10n::t('Forbidden Nicknames'), Config::get('system', 'forbidden_nicknames'), L10n::t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
|
||||||
'$abandon_days' => ['abandon_days', L10n::t('Accounts abandoned after x days'), Config::get('system','account_abandon_days'), L10n::t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
|
'$abandon_days' => ['abandon_days', L10n::t('Accounts abandoned after x days'), Config::get('system','account_abandon_days'), L10n::t('Will not waste system resources polling external sites for abandonded accounts. Enter 0 for no time limit.')],
|
||||||
'$allowed_sites' => ['allowed_sites', L10n::t("Allowed friend domains"), Config::get('system','allowed_sites'), L10n::t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")],
|
'$allowed_sites' => ['allowed_sites', L10n::t("Allowed friend domains"), Config::get('system','allowed_sites'), L10n::t("Comma separated list of domains which are allowed to establish friendships with this site. Wildcards are accepted. Empty to allow any domains")],
|
||||||
'$allowed_email' => ['allowed_email', L10n::t("Allowed email domains"), Config::get('system','allowed_email'), L10n::t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")],
|
'$allowed_email' => ['allowed_email', L10n::t("Allowed email domains"), Config::get('system','allowed_email'), L10n::t("Comma separated list of domains which are allowed in email addresses for registrations to this site. Wildcards are accepted. Empty to allow any domains")],
|
||||||
|
@ -1666,13 +1668,13 @@ function admin_page_users_post(App $a)
|
||||||
|
|
||||||
Thank you and welcome to %4$s.'));
|
Thank you and welcome to %4$s.'));
|
||||||
|
|
||||||
$preamble = sprintf($preamble, $user['username'], $a->config['sitename']);
|
$preamble = sprintf($preamble, $user['username'], Config::get('config', 'sitename'));
|
||||||
$body = sprintf($body, System::baseUrl(), $user['email'], $result['password'], $a->config['sitename']);
|
$body = sprintf($body, System::baseUrl(), $user['email'], $result['password'], Config::get('config', 'sitename'));
|
||||||
|
|
||||||
notification([
|
notification([
|
||||||
'type' => SYSTEM_EMAIL,
|
'type' => SYSTEM_EMAIL,
|
||||||
'to_email' => $user['email'],
|
'to_email' => $user['email'],
|
||||||
'subject' => L10n::t('Registration details for %s', $a->config['sitename']),
|
'subject' => L10n::t('Registration details for %s', Config::get('config', 'sitename')),
|
||||||
'preamble' => $preamble,
|
'preamble' => $preamble,
|
||||||
'body' => $body]);
|
'body' => $body]);
|
||||||
}
|
}
|
||||||
|
@ -1797,7 +1799,7 @@ function admin_page_users(App $a)
|
||||||
ORDER BY $sql_order $sql_order_direction LIMIT %d, %d", intval($a->pager['start']), intval($a->pager['itemspage'])
|
ORDER BY $sql_order $sql_order_direction LIMIT %d, %d", intval($a->pager['start']), intval($a->pager['itemspage'])
|
||||||
);
|
);
|
||||||
|
|
||||||
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
|
$adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||||
$_setup_users = function ($e) use ($adminlist) {
|
$_setup_users = function ($e) use ($adminlist) {
|
||||||
$page_types = [
|
$page_types = [
|
||||||
PAGE_NORMAL => L10n::t('Normal Account Page'),
|
PAGE_NORMAL => L10n::t('Normal Account Page'),
|
||||||
|
@ -1824,7 +1826,6 @@ function admin_page_users(App $a)
|
||||||
$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
|
$e['register_date'] = Temporal::getRelativeDate($e['register_date']);
|
||||||
$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
|
$e['login_date'] = Temporal::getRelativeDate($e['login_date']);
|
||||||
$e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']);
|
$e['lastitem_date'] = Temporal::getRelativeDate($e['lastitem_date']);
|
||||||
//$e['is_admin'] = ($e['email'] === $a->config['admin_email']);
|
|
||||||
$e['is_admin'] = in_array($e['email'], $adminlist);
|
$e['is_admin'] = in_array($e['email'], $adminlist);
|
||||||
$e['is_deletable'] = (intval($e['uid']) != local_user());
|
$e['is_deletable'] = (intval($e['uid']) != local_user());
|
||||||
$e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
|
$e['deleted'] = ($e['account_removed'] ? Temporal::getRelativeDate($e['account_expires_on']) : False);
|
||||||
|
@ -2378,7 +2379,7 @@ function admin_page_logs(App $a)
|
||||||
'$loglevel' => ['loglevel', L10n::t("Log level"), Config::get('system', 'loglevel'), "", $log_choices],
|
'$loglevel' => ['loglevel', L10n::t("Log level"), Config::get('system', 'loglevel'), "", $log_choices],
|
||||||
'$form_security_token' => get_form_security_token("admin_logs"),
|
'$form_security_token' => get_form_security_token("admin_logs"),
|
||||||
'$phpheader' => L10n::t("PHP logging"),
|
'$phpheader' => L10n::t("PHP logging"),
|
||||||
'$phphint' => L10n::t("To enable logging of PHP errors and warnings you can add the following to the .htconfig.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
'$phphint' => L10n::t("To temporarily enable logging of PHP errors and warnings you can prepend the following to the index.php file of your installation. The filename set in the 'error_log' line is relative to the friendica top-level directory and must be writeable by the web server. The option '1' for 'log_errors' and 'display_errors' is to enable these options, set to '0' to disable them."),
|
||||||
'$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE);\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');",
|
'$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE);\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');",
|
||||||
'$phplogenabled' => $phplogenabled,
|
'$phplogenabled' => $phplogenabled,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\ACL;
|
use Friendica\Core\ACL;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Module\Login;
|
use Friendica\Module\Login;
|
||||||
|
@ -21,7 +22,7 @@ function bookmarklet_content(App $a)
|
||||||
{
|
{
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
$o = '<h2>' . L10n::t('Login') . '</h2>';
|
$o = '<h2>' . L10n::t('Login') . '</h2>';
|
||||||
$o .= Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? false : true);
|
$o .= Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? false : true);
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -611,7 +611,7 @@ function dfrn_request_content(App $a)
|
||||||
} elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
|
} elseif (x($_GET, 'address') && ($_GET['address'] != "")) {
|
||||||
$myaddr = $_GET['address'];
|
$myaddr = $_GET['address'];
|
||||||
} elseif (local_user()) {
|
} elseif (local_user()) {
|
||||||
if (strlen($a->path)) {
|
if (strlen($a->urlpath)) {
|
||||||
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
$myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
||||||
} else {
|
} else {
|
||||||
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
|
$myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(), '://') + 3);
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
/**
|
/**
|
||||||
* @file mod/friendica.php
|
* @file mod/friendica.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
use Friendica\Core\System;
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
|
||||||
function friendica_init(App $a)
|
function friendica_init(App $a)
|
||||||
|
@ -16,10 +17,10 @@ function friendica_init(App $a)
|
||||||
|
|
||||||
$sql_extra = '';
|
$sql_extra = '';
|
||||||
if (x($a->config, 'admin_nickname')) {
|
if (x($a->config, 'admin_nickname')) {
|
||||||
$sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc($a->config['admin_nickname']));
|
$sql_extra = sprintf(" AND `nickname` = '%s' ", dbesc(Config::get('config', 'admin_nickname')));
|
||||||
}
|
}
|
||||||
if (isset($a->config['admin_email']) && $a->config['admin_email']!='') {
|
if (!empty(Config::get('config', 'admin_email'))) {
|
||||||
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
|
$adminlist = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||||
|
|
||||||
$r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0]));
|
$r = q("SELECT `username`, `nickname` FROM `user` WHERE `email` = '%s' $sql_extra", dbesc($adminlist[0]));
|
||||||
$admin = [
|
$admin = [
|
||||||
|
@ -55,13 +56,13 @@ function friendica_init(App $a)
|
||||||
$data = [
|
$data = [
|
||||||
'version' => FRIENDICA_VERSION,
|
'version' => FRIENDICA_VERSION,
|
||||||
'url' => System::baseUrl(),
|
'url' => System::baseUrl(),
|
||||||
'addons' => $visible_addons,
|
'addons' => $visible_addons,
|
||||||
'locked_features' => $locked_features,
|
'locked_features' => $locked_features,
|
||||||
'register_policy' => $register_policy[$a->config['register_policy']],
|
'register_policy' => $register_policy[intval(Config::get('config', 'register_policy'))],
|
||||||
'admin' => $admin,
|
'admin' => $admin,
|
||||||
'site_name' => $a->config['sitename'],
|
'site_name' => Config::get('config', 'sitename'),
|
||||||
'platform' => FRIENDICA_PLATFORM,
|
'platform' => FRIENDICA_PLATFORM,
|
||||||
'info' => ((x($a->config, 'info')) ? $a->config['info'] : ''),
|
'info' => Config::get('config', 'info'),
|
||||||
'no_scrape_url' => System::baseUrl().'/noscrape'
|
'no_scrape_url' => System::baseUrl().'/noscrape'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ function hcard_init(App $a)
|
||||||
|
|
||||||
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
$a->page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n" ;
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/dfrn_poll/' . $which .'" />' . "\r\n" ;
|
||||||
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
|
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->urlpath) ? '/' . $a->urlpath : ''));
|
||||||
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||||
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
|
|
94
mod/help.php
94
mod/help.php
|
@ -2,44 +2,45 @@
|
||||||
/**
|
/**
|
||||||
* @file mod/help.php
|
* @file mod/help.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\Nav;
|
use Friendica\Content\Nav;
|
||||||
use Friendica\Content\Text\Markdown;
|
use Friendica\Content\Text\Markdown;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
|
||||||
if (!function_exists('load_doc_file')) {
|
function load_doc_file($s)
|
||||||
|
{
|
||||||
function load_doc_file($s) {
|
$lang = Config::get('system', 'language');
|
||||||
global $lang;
|
$b = basename($s);
|
||||||
if (!isset($lang))
|
$d = dirname($s);
|
||||||
$lang = 'en';
|
if (file_exists("$d/$lang/$b")) {
|
||||||
$b = basename($s);
|
return file_get_contents("$d/$lang/$b");
|
||||||
$d = dirname($s);
|
|
||||||
if (file_exists("$d/$lang/$b"))
|
|
||||||
return file_get_contents("$d/$lang/$b");
|
|
||||||
if (file_exists($s))
|
|
||||||
return file_get_contents($s);
|
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (file_exists($s)) {
|
||||||
|
return file_get_contents($s);
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function help_content(App $a) {
|
function help_content(App $a)
|
||||||
|
{
|
||||||
Nav::setSelected('help');
|
Nav::setSelected('help');
|
||||||
|
|
||||||
global $lang;
|
|
||||||
|
|
||||||
$text = '';
|
$text = '';
|
||||||
|
|
||||||
if ($a->argc > 1) {
|
if ($a->argc > 1) {
|
||||||
$path = '';
|
$path = '';
|
||||||
// looping through the argv keys bigger than 0 to build
|
// looping through the argv keys bigger than 0 to build
|
||||||
// a path relative to /help
|
// a path relative to /help
|
||||||
for($x = 1; $x < argc(); $x ++) {
|
for ($x = 1; $x < argc(); $x ++) {
|
||||||
if(strlen($path))
|
if (strlen($path)) {
|
||||||
$path .= '/';
|
$path .= '/';
|
||||||
|
}
|
||||||
|
|
||||||
$path .= argv($x);
|
$path .= argv($x);
|
||||||
}
|
}
|
||||||
$title = basename($path);
|
$title = basename($path);
|
||||||
|
@ -47,6 +48,7 @@ function help_content(App $a) {
|
||||||
$text = load_doc_file('doc/' . $path . '.md');
|
$text = load_doc_file('doc/' . $path . '.md');
|
||||||
$a->page['title'] = L10n::t('Help:') . ' ' . str_replace('-', ' ', notags($title));
|
$a->page['title'] = L10n::t('Help:') . ' ' . str_replace('-', ' ', notags($title));
|
||||||
}
|
}
|
||||||
|
|
||||||
$home = load_doc_file('doc/Home.md');
|
$home = load_doc_file('doc/Home.md');
|
||||||
if (!$text) {
|
if (!$text) {
|
||||||
$text = $home;
|
$text = $home;
|
||||||
|
@ -60,8 +62,8 @@ function help_content(App $a) {
|
||||||
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
|
header($_SERVER["SERVER_PROTOCOL"] . ' 404 ' . L10n::t('Not Found'));
|
||||||
$tpl = get_markup_template("404.tpl");
|
$tpl = get_markup_template("404.tpl");
|
||||||
return replace_macros($tpl, [
|
return replace_macros($tpl, [
|
||||||
'$message' => L10n::t('Page not found.')
|
'$message' => L10n::t('Page not found.')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = Markdown::convert($text, false);
|
$html = Markdown::convert($text, false);
|
||||||
|
@ -69,34 +71,46 @@ function help_content(App $a) {
|
||||||
if ($filename !== "Home") {
|
if ($filename !== "Home") {
|
||||||
// create TOC but not for home
|
// create TOC but not for home
|
||||||
$lines = explode("\n", $html);
|
$lines = explode("\n", $html);
|
||||||
$toc="<h2>TOC</h2><ul id='toc'>";
|
$toc = "<h2>TOC</h2><ul id='toc'>";
|
||||||
$lastlevel=1;
|
$lastlevel = 1;
|
||||||
$idnum = [0,0,0,0,0,0,0];
|
$idnum = [0, 0, 0, 0, 0, 0, 0];
|
||||||
foreach($lines as &$line){
|
foreach ($lines as &$line) {
|
||||||
if (substr($line,0,2)=="<h") {
|
if (substr($line, 0, 2) == "<h") {
|
||||||
$level = substr($line,2,1);
|
$level = substr($line, 2, 1);
|
||||||
if ($level!="r") {
|
if ($level != "r") {
|
||||||
$level = intval($level);
|
$level = intval($level);
|
||||||
if ($level<$lastlevel) {
|
if ($level < $lastlevel) {
|
||||||
for($k=$level;$k<$lastlevel; $k++) $toc.="</ul>";
|
for ($k = $level; $k < $lastlevel; $k++) {
|
||||||
for($k=$level+1;$k<count($idnum);$k++) $idnum[$k]=0;
|
$toc .= "</ul>";
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($k = $level + 1; $k < count($idnum); $k++) {
|
||||||
|
$idnum[$k] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($level>$lastlevel) $toc.="<ul>";
|
|
||||||
$idnum[$level]++;
|
if ($level > $lastlevel) {
|
||||||
$id = implode("_", array_slice($idnum,1,$level));
|
$toc .= "<ul>";
|
||||||
$href = System::baseUrl()."/help/{$filename}#{$id}";
|
}
|
||||||
$toc .= "<li><a href='{$href}'>".strip_tags($line)."</a></li>";
|
|
||||||
$line = "<a name='{$id}'></a>".$line;
|
$idnum[$level] ++;
|
||||||
|
$id = implode("_", array_slice($idnum, 1, $level));
|
||||||
|
$href = System::baseUrl() . "/help/{$filename}#{$id}";
|
||||||
|
$toc .= "<li><a href='{$href}'>" . strip_tags($line) . "</a></li>";
|
||||||
|
$line = "<a name='{$id}'></a>" . $line;
|
||||||
$lastlevel = $level;
|
$lastlevel = $level;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for($k=0;$k<$lastlevel; $k++) $toc.="</ul>";
|
|
||||||
$html = implode("\n",$lines);
|
for ($k = 0; $k < $lastlevel; $k++) {
|
||||||
|
$toc .= "</ul>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$html = implode("\n", $lines);
|
||||||
|
|
||||||
$a->page['aside'] = '<div class="help-aside-wrapper widget"><div id="toc-wrapper">' . $toc . '</div>' . $a->page['aside'] . '</div>';
|
$a->page['aside'] = '<div class="help-aside-wrapper widget"><div id="toc-wrapper">' . $toc . '</div>' . $a->page['aside'] . '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ function home_content(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$customhome = false;
|
$customhome = false;
|
||||||
$defaultheader = '<h1>'.((x($a->config,'sitename')) ? L10n::t("Welcome to %s", $a->config['sitename']) : "").'</h1>';
|
$defaultheader = '<h1>' . (Config::get('config', 'sitename') ? L10n::t('Welcome to %s', Config::get('config', 'sitename')) : '') . '</h1>';
|
||||||
|
|
||||||
$homefilepath = $a->basepath . "/home.html";
|
$homefilepath = $a->basepath . "/home.html";
|
||||||
$cssfilepath = $a->basepath . "/home.css";
|
$cssfilepath = $a->basepath . "/home.css";
|
||||||
|
@ -45,9 +45,9 @@ function home_content(App $a) {
|
||||||
if (file_exists($cssfilepath)) {
|
if (file_exists($cssfilepath)) {
|
||||||
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
|
$a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="'.System::baseUrl().'/home.css'.'" media="all" />';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$login = Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
|
$login = Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||||
|
|
||||||
$content = '';
|
$content = '';
|
||||||
Addon::callHooks("home_content",$content);
|
Addon::callHooks("home_content",$content);
|
||||||
|
|
|
@ -22,7 +22,8 @@ function install_init(App $a) {
|
||||||
|
|
||||||
// We overwrite current theme css, because during install we could not have a working mod_rewrite
|
// We overwrite current theme css, because during install we could not have a working mod_rewrite
|
||||||
// so we could not have a css at all. Here we set a static css file for the install procedure pages
|
// so we could not have a css at all. Here we set a static css file for the install procedure pages
|
||||||
$a->config['system']['theme'] = "../install";
|
|
||||||
|
$a->setConfigValue('system', 'value', '../install');
|
||||||
$a->theme['stylesheet'] = System::baseUrl()."/view/install/style.css";
|
$a->theme['stylesheet'] = System::baseUrl()."/view/install/style.css";
|
||||||
|
|
||||||
Install::setInstallMode();
|
Install::setInstallMode();
|
||||||
|
@ -67,12 +68,11 @@ function install_post(App $a) {
|
||||||
$timezone = notags(trim($_POST['timezone']));
|
$timezone = notags(trim($_POST['timezone']));
|
||||||
$language = notags(trim($_POST['language']));
|
$language = notags(trim($_POST['language']));
|
||||||
$adminmail = notags(trim($_POST['adminmail']));
|
$adminmail = notags(trim($_POST['adminmail']));
|
||||||
$rino = 1;
|
|
||||||
|
|
||||||
// connect to db
|
// connect to db
|
||||||
dba::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
dba::connect($dbhost, $dbuser, $dbpass, $dbdata);
|
||||||
|
|
||||||
Install::install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail, $rino);
|
Install::install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
|
@ -140,9 +140,7 @@ function install_content(App $a) {
|
||||||
switch ($install_wizard_pass) {
|
switch ($install_wizard_pass) {
|
||||||
case 1: { // System check
|
case 1: { // System check
|
||||||
|
|
||||||
if (x($_POST, 'phpath')) {
|
$phpath = defaults($_POST, 'phpath', 'php');
|
||||||
$phpath = notags(trim($_POST['phpath']));
|
|
||||||
}
|
|
||||||
|
|
||||||
list($checks, $checkspassed) = Install::check($phpath);
|
list($checks, $checkspassed) = Install::check($phpath);
|
||||||
|
|
||||||
|
@ -163,13 +161,12 @@ function install_content(App $a) {
|
||||||
|
|
||||||
case 2: { // Database config
|
case 2: { // Database config
|
||||||
|
|
||||||
$dbhost = ((x($_POST, 'dbhost')) ? notags(trim($_POST['dbhost'])) : 'localhost');
|
$dbhost = notags(trim(defaults($_POST, 'dbhost' , 'localhost')));
|
||||||
$dbuser = notags(trim($_POST['dbuser']));
|
$dbuser = notags(trim(defaults($_POST, 'dbuser' , '' )));
|
||||||
$dbpass = notags(trim($_POST['dbpass']));
|
$dbpass = notags(trim(defaults($_POST, 'dbpass' , '' )));
|
||||||
$dbdata = notags(trim($_POST['dbdata']));
|
$dbdata = notags(trim(defaults($_POST, 'dbdata' , '' )));
|
||||||
$phpath = notags(trim($_POST['phpath']));
|
$phpath = notags(trim(defaults($_POST, 'phpath' , '' )));
|
||||||
|
$adminmail = notags(trim(defaults($_POST, 'adminmail', '' )));
|
||||||
$adminmail = notags(trim($_POST['adminmail']));
|
|
||||||
|
|
||||||
$tpl = get_markup_template('install_db.tpl');
|
$tpl = get_markup_template('install_db.tpl');
|
||||||
$o .= replace_macros($tpl, [
|
$o .= replace_macros($tpl, [
|
||||||
|
@ -187,8 +184,6 @@ function install_content(App $a) {
|
||||||
'$dbdata' => ['dbdata', L10n::t('Database Name'), $dbdata, '', 'required'],
|
'$dbdata' => ['dbdata', L10n::t('Database Name'), $dbdata, '', 'required'],
|
||||||
'$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
|
'$adminmail' => ['adminmail', L10n::t('Site administrator email address'), $adminmail, L10n::t('Your account email address must match this in order to use the web admin panel.'), 'required', 'autofocus', 'email'],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
'$lbl_10' => L10n::t('Please select a default timezone for your website'),
|
'$lbl_10' => L10n::t('Please select a default timezone for your website'),
|
||||||
|
|
||||||
'$baseurl' => System::baseUrl(),
|
'$baseurl' => System::baseUrl(),
|
||||||
|
@ -196,7 +191,6 @@ function install_content(App $a) {
|
||||||
'$phpath' => $phpath,
|
'$phpath' => $phpath,
|
||||||
|
|
||||||
'$submit' => L10n::t('Submit'),
|
'$submit' => L10n::t('Submit'),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
return $o;
|
return $o;
|
||||||
}; break;
|
}; break;
|
||||||
|
@ -245,7 +239,7 @@ function install_content(App $a) {
|
||||||
|
|
||||||
function manual_config(App $a) {
|
function manual_config(App $a) {
|
||||||
$data = htmlentities($a->data['txt'],ENT_COMPAT, 'UTF-8');
|
$data = htmlentities($a->data['txt'],ENT_COMPAT, 'UTF-8');
|
||||||
$o = L10n::t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
|
$o = L10n::t('The database configuration file "config/local.ini.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
|
||||||
$o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
|
$o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,14 +126,14 @@ function invite_content(App $a) {
|
||||||
|
|
||||||
$dirloc = Config::get('system', 'directory');
|
$dirloc = Config::get('system', 'directory');
|
||||||
if (strlen($dirloc)) {
|
if (strlen($dirloc)) {
|
||||||
if ($a->config['register_policy'] == REGISTER_CLOSED) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||||
$linktxt = L10n::t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirloc . '/servers');
|
$linktxt = L10n::t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.', $dirloc . '/servers');
|
||||||
} else {
|
} else {
|
||||||
$linktxt = L10n::t('To accept this invitation, please visit and register at %s or any other public Friendica website.', System::baseUrl())
|
$linktxt = L10n::t('To accept this invitation, please visit and register at %s or any other public Friendica website.', System::baseUrl())
|
||||||
. "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirloc . '/servers');
|
. "\r\n" . "\r\n" . L10n::t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.', $dirloc . '/servers');
|
||||||
}
|
}
|
||||||
} else { // there is no global directory URL defined
|
} else { // there is no global directory URL defined
|
||||||
if ($a->config['register_policy'] == REGISTER_CLOSED) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||||
$o = L10n::t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
|
$o = L10n::t('Our apologies. This system is not currently configured to connect with other public sites or invite members.');
|
||||||
return $o;
|
return $o;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -39,7 +39,7 @@ function lostpass_post(App $a)
|
||||||
info(L10n::t('Password reset request issued. Check your email.') . EOL);
|
info(L10n::t('Password reset request issued. Check your email.') . EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sitename = $a->config['sitename'];
|
$sitename = Config::get('config', 'sitename');
|
||||||
$resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token;
|
$resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token;
|
||||||
|
|
||||||
$preamble = deindent(L10n::t('
|
$preamble = deindent(L10n::t('
|
||||||
|
@ -145,7 +145,7 @@ function lostpass_generate_password($user)
|
||||||
|
|
||||||
info("Your password has been reset." . EOL);
|
info("Your password has been reset." . EOL);
|
||||||
|
|
||||||
$sitename = $a->config['sitename'];
|
$sitename = Config::get('config', 'sitename');
|
||||||
$preamble = deindent(L10n::t('
|
$preamble = deindent(L10n::t('
|
||||||
Dear %1$s,
|
Dear %1$s,
|
||||||
Your password has been changed as requested. Please retain this
|
Your password has been changed as requested. Please retain this
|
||||||
|
|
|
@ -61,9 +61,9 @@ function nodeinfo_init(App $a) {
|
||||||
|
|
||||||
$nodeinfo['usage'] = [];
|
$nodeinfo['usage'] = [];
|
||||||
|
|
||||||
$nodeinfo['openRegistrations'] = ($a->config['register_policy'] != 0);
|
$nodeinfo['openRegistrations'] = intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED;
|
||||||
|
|
||||||
$nodeinfo['metadata'] = ['nodeName' => $a->config['sitename']];
|
$nodeinfo['metadata'] = ['nodeName' => Config::get('config', 'sitename')];
|
||||||
|
|
||||||
if (Config::get('system', 'nodeinfo')) {
|
if (Config::get('system', 'nodeinfo')) {
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ function openid_content(App $a) {
|
||||||
// Successful OpenID login - but we can't match it to an existing account.
|
// Successful OpenID login - but we can't match it to an existing account.
|
||||||
// New registration?
|
// New registration?
|
||||||
|
|
||||||
if ($a->config['register_policy'] == REGISTER_CLOSED) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED) {
|
||||||
notice(L10n::t('Account not found and OpenID registration is not permitted on this site.') . EOL);
|
notice(L10n::t('Account not found and OpenID registration is not permitted on this site.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway(System::baseUrl());
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ use Friendica\Content\ForumManager;
|
||||||
use Friendica\Content\Text\BBCode;
|
use Friendica\Content\Text\BBCode;
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
@ -200,7 +201,7 @@ function ping_init(App $a)
|
||||||
);
|
);
|
||||||
$mail_count = count($mails);
|
$mail_count = count($mails);
|
||||||
|
|
||||||
if ($a->config['register_policy'] == REGISTER_APPROVE && is_site_admin()) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE && is_site_admin()) {
|
||||||
$regs = q(
|
$regs = q(
|
||||||
"SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`
|
"SELECT `contact`.`name`, `contact`.`url`, `contact`.`micro`, `register`.`created`
|
||||||
FROM `contact` RIGHT JOIN `register` ON `register`.`uid` = `contact`.`uid`
|
FROM `contact` RIGHT JOIN `register` ON `register`.`uid` = `contact`.`uid`
|
||||||
|
|
|
@ -79,7 +79,7 @@ function profile_init(App $a)
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/" title="' . L10n::t('%s\'s posts', $a->profile['username']) . '"/>' . "\r\n";
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/comments" title="' . L10n::t('%s\'s comments', $a->profile['username']) . '"/>' . "\r\n";
|
||||||
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . System::baseUrl() . '/feed/' . $which . '/activity" title="' . L10n::t('%s\'s timeline', $a->profile['username']) . '"/>' . "\r\n";
|
||||||
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''));
|
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''));
|
||||||
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . System::baseUrl() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||||
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . System::baseUrl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
|
|
|
@ -13,54 +13,52 @@ use Friendica\Model\Contact;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
use Friendica\Object\Image;
|
use Friendica\Object\Image;
|
||||||
use Friendica\Util\DateTimeFormat;
|
|
||||||
|
|
||||||
function profile_photo_init(App $a)
|
function profile_photo_init(App $a)
|
||||||
{
|
{
|
||||||
if (! local_user()) {
|
if (!local_user()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile::load($a, $a->user['nickname']);
|
Profile::load($a, $a->user['nickname']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function profile_photo_post(App $a) {
|
function profile_photo_post(App $a)
|
||||||
|
{
|
||||||
|
|
||||||
if (! local_user()) {
|
if (!local_user()) {
|
||||||
notice(L10n::t('Permission denied.') . EOL );
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
|
check_form_security_token_redirectOnErr('/profile_photo', 'profile_photo');
|
||||||
|
|
||||||
if((x($_POST,'cropfinal')) && ($_POST['cropfinal'] == 1)) {
|
if ((x($_POST, 'cropfinal')) && ($_POST['cropfinal'] == 1)) {
|
||||||
|
|
||||||
// unless proven otherwise
|
// unless proven otherwise
|
||||||
$is_default_profile = 1;
|
$is_default_profile = 1;
|
||||||
|
|
||||||
if($_REQUEST['profile']) {
|
if ($_REQUEST['profile']) {
|
||||||
$r = q("select id, `is-default` from profile where id = %d and uid = %d limit 1",
|
$r = q("select id, `is-default` from profile where id = %d and uid = %d limit 1", intval($_REQUEST['profile']),
|
||||||
intval($_REQUEST['profile']),
|
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
if (DBM::is_result($r) && (! intval($r[0]['is-default'])))
|
if (DBM::is_result($r) && (!intval($r[0]['is-default']))) $is_default_profile = 0;
|
||||||
$is_default_profile = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// phase 2 - we have finished cropping
|
// phase 2 - we have finished cropping
|
||||||
|
|
||||||
if($a->argc != 2) {
|
if ($a->argc != 2) {
|
||||||
notice(L10n::t('Image uploaded but image cropping failed.') . EOL );
|
notice(L10n::t('Image uploaded but image cropping failed.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$image_id = $a->argv[1];
|
$image_id = $a->argv[1];
|
||||||
|
|
||||||
if(substr($image_id,-2,1) == '-') {
|
if (substr($image_id, -2, 1) == '-') {
|
||||||
$scale = substr($image_id,-1,1);
|
$scale = substr($image_id, -1, 1);
|
||||||
$image_id = substr($image_id,0,-2);
|
$image_id = substr($image_id, 0, -2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,10 +67,8 @@ function profile_photo_post(App $a) {
|
||||||
$srcW = $_POST['xfinal'] - $srcX;
|
$srcW = $_POST['xfinal'] - $srcX;
|
||||||
$srcH = $_POST['yfinal'] - $srcY;
|
$srcH = $_POST['yfinal'] - $srcY;
|
||||||
|
|
||||||
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = %d LIMIT 1",
|
$r = q("SELECT * FROM `photo` WHERE `resource-id` = '%s' AND `uid` = %d AND `scale` = %d LIMIT 1", dbesc($image_id),
|
||||||
dbesc($image_id),
|
dbesc(local_user()), intval($scale));
|
||||||
dbesc(local_user()),
|
|
||||||
intval($scale));
|
|
||||||
|
|
||||||
if (DBM::is_result($r)) {
|
if (DBM::is_result($r)) {
|
||||||
|
|
||||||
|
@ -80,9 +76,10 @@ function profile_photo_post(App $a) {
|
||||||
|
|
||||||
$Image = new Image($base_image['data'], $base_image['type']);
|
$Image = new Image($base_image['data'], $base_image['type']);
|
||||||
if ($Image->isValid()) {
|
if ($Image->isValid()) {
|
||||||
$Image->crop(175,$srcX,$srcY,$srcW,$srcH);
|
$Image->crop(175, $srcX, $srcY, $srcW, $srcH);
|
||||||
|
|
||||||
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], L10n::t('Profile Photos'), 4, $is_default_profile);
|
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'], $base_image['filename'],
|
||||||
|
L10n::t('Profile Photos'), 4, $is_default_profile);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice(L10n::t('Image size reduction [%s] failed.', "175") . EOL);
|
notice(L10n::t('Image size reduction [%s] failed.', "175") . EOL);
|
||||||
|
@ -90,7 +87,8 @@ function profile_photo_post(App $a) {
|
||||||
|
|
||||||
$Image->scaleDown(80);
|
$Image->scaleDown(80);
|
||||||
|
|
||||||
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], L10n::t('Profile Photos'), 5, $is_default_profile);
|
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'], $base_image['filename'],
|
||||||
|
L10n::t('Profile Photos'), 5, $is_default_profile);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice(L10n::t('Image size reduction [%s] failed.', "80") . EOL);
|
notice(L10n::t('Image size reduction [%s] failed.', "80") . EOL);
|
||||||
|
@ -98,7 +96,8 @@ function profile_photo_post(App $a) {
|
||||||
|
|
||||||
$Image->scaleDown(48);
|
$Image->scaleDown(48);
|
||||||
|
|
||||||
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'],$base_image['filename'], L10n::t('Profile Photos'), 6, $is_default_profile);
|
$r = Photo::store($Image, local_user(), 0, $base_image['resource-id'], $base_image['filename'],
|
||||||
|
L10n::t('Profile Photos'), 6, $is_default_profile);
|
||||||
|
|
||||||
if ($r === false) {
|
if ($r === false) {
|
||||||
notice(L10n::t('Image size reduction [%s] failed.', "48") . EOL);
|
notice(L10n::t('Image size reduction [%s] failed.', "48") . EOL);
|
||||||
|
@ -108,15 +107,13 @@ function profile_photo_post(App $a) {
|
||||||
|
|
||||||
if ($is_default_profile) {
|
if ($is_default_profile) {
|
||||||
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
|
$r = q("UPDATE `photo` SET `profile` = 0 WHERE `profile` = 1 AND `resource-id` != '%s' AND `uid` = %d",
|
||||||
dbesc($base_image['resource-id']),
|
dbesc($base_image['resource-id']), intval(local_user())
|
||||||
intval(local_user())
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
|
$r = q("update profile set photo = '%s', thumb = '%s' where id = %d and uid = %d",
|
||||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-4.' . $Image->getExt()),
|
||||||
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
|
dbesc(System::baseUrl() . '/photo/' . $base_image['resource-id'] . '-5.' . $Image->getExt()),
|
||||||
intval($_REQUEST['profile']),
|
intval($_REQUEST['profile']), intval(local_user())
|
||||||
intval(local_user())
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +122,7 @@ function profile_photo_post(App $a) {
|
||||||
info(L10n::t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
|
info(L10n::t('Shift-reload the page or clear browser cache if the new photo does not display immediately.') . EOL);
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
$url = System::baseUrl() . '/profile/' . $a->user['nickname'];
|
||||||
if ($url && strlen(Config::get('system','directory'))) {
|
if ($url && strlen(Config::get('system', 'directory'))) {
|
||||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +136,7 @@ function profile_photo_post(App $a) {
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
$src = $_FILES['userfile']['tmp_name'];
|
$src = $_FILES['userfile']['tmp_name'];
|
||||||
$filename = basename($_FILES['userfile']['name']);
|
$filename = basename($_FILES['userfile']['name']);
|
||||||
$filesize = intval($_FILES['userfile']['size']);
|
$filesize = intval($_FILES['userfile']['size']);
|
||||||
$filetype = $_FILES['userfile']['type'];
|
$filetype = $_FILES['userfile']['type'];
|
||||||
|
@ -158,7 +155,7 @@ function profile_photo_post(App $a) {
|
||||||
$imagedata = @file_get_contents($src);
|
$imagedata = @file_get_contents($src);
|
||||||
$ph = new Image($imagedata, $filetype);
|
$ph = new Image($imagedata, $filetype);
|
||||||
|
|
||||||
if (! $ph->isValid()) {
|
if (!$ph->isValid()) {
|
||||||
notice(L10n::t('Unable to process image.') . EOL);
|
notice(L10n::t('Unable to process image.') . EOL);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
return;
|
return;
|
||||||
|
@ -166,25 +163,28 @@ function profile_photo_post(App $a) {
|
||||||
|
|
||||||
$ph->orient($src);
|
$ph->orient($src);
|
||||||
@unlink($src);
|
@unlink($src);
|
||||||
return profile_photo_crop_ui_head($a, $ph);
|
profile_photo_crop_ui_head($a, $ph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function profile_photo_content(App $a)
|
||||||
|
{
|
||||||
|
|
||||||
function profile_photo_content(App $a) {
|
if (!local_user()) {
|
||||||
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
if (! local_user()) {
|
|
||||||
notice(L10n::t('Permission denied.') . EOL );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$newuser = false;
|
$newuser = false;
|
||||||
|
|
||||||
if($a->argc == 2 && $a->argv[1] === 'new')
|
if ($a->argc == 2 && $a->argv[1] === 'new') {
|
||||||
$newuser = true;
|
$newuser = true;
|
||||||
|
}
|
||||||
|
|
||||||
if( $a->argv[1]=='use'){
|
$imagecrop = [];
|
||||||
if ($a->argc<3){
|
|
||||||
notice(L10n::t('Permission denied.') . EOL );
|
if ($a->argv[1] == 'use') {
|
||||||
|
if ($a->argc < 3) {
|
||||||
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -192,36 +192,32 @@ function profile_photo_content(App $a) {
|
||||||
|
|
||||||
$resource_id = $a->argv[2];
|
$resource_id = $a->argv[2];
|
||||||
//die(":".local_user());
|
//die(":".local_user());
|
||||||
$r=q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC",
|
$r = q("SELECT * FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s' ORDER BY `scale` ASC", intval(local_user()),
|
||||||
intval(local_user()),
|
|
||||||
dbesc($resource_id)
|
dbesc($resource_id)
|
||||||
);
|
);
|
||||||
if (!DBM::is_result($r)){
|
if (!DBM::is_result($r)) {
|
||||||
notice(L10n::t('Permission denied.') . EOL );
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$havescale = false;
|
$havescale = false;
|
||||||
foreach ($r as $rr) {
|
foreach ($r as $rr) {
|
||||||
if($rr['scale'] == 5)
|
if ($rr['scale'] == 5) $havescale = true;
|
||||||
$havescale = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// set an already uloaded photo as profile photo
|
// set an already uloaded photo as profile photo
|
||||||
// if photo is in 'Profile Photos', change it in db
|
// if photo is in 'Profile Photos', change it in db
|
||||||
if (($r[0]['album']== L10n::t('Profile Photos')) && ($havescale)){
|
if (($r[0]['album'] == L10n::t('Profile Photos')) && ($havescale)) {
|
||||||
$r=q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d",
|
$r = q("UPDATE `photo` SET `profile`=0 WHERE `profile`=1 AND `uid`=%d", intval(local_user()));
|
||||||
intval(local_user()));
|
|
||||||
|
|
||||||
$r=q("UPDATE `photo` SET `profile`=1 WHERE `uid` = %d AND `resource-id` = '%s'",
|
$r = q("UPDATE `photo` SET `profile`=1 WHERE `uid` = %d AND `resource-id` = '%s'", intval(local_user()),
|
||||||
intval(local_user()),
|
|
||||||
dbesc($resource_id)
|
dbesc($resource_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
Contact::updateSelfFromUserID(local_user(), true);
|
Contact::updateSelfFromUserID(local_user(), true);
|
||||||
|
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = $_SESSION['my_url'];
|
$url = $_SESSION['my_url'];
|
||||||
if ($url && strlen(Config::get('system','directory'))) {
|
if ($url && strlen(Config::get('system', 'directory'))) {
|
||||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +225,7 @@ function profile_photo_content(App $a) {
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
$ph = new Image($r[0]['data'], $r[0]['type']);
|
$ph = new Image($r[0]['data'], $r[0]['type']);
|
||||||
profile_photo_crop_ui_head($a, $ph);
|
$imagecrop = profile_photo_crop_ui_head($a, $ph);
|
||||||
// go ahead as we have jus uploaded a new photo to crop
|
// go ahead as we have jus uploaded a new photo to crop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,11 +234,11 @@ function profile_photo_content(App $a) {
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if(! x($a->config,'imagecrop')) {
|
if (!empty($imagecrop)) {
|
||||||
|
|
||||||
$tpl = get_markup_template('profile_photo.tpl');
|
$tpl = get_markup_template('profile_photo.tpl');
|
||||||
|
|
||||||
$o = replace_macros($tpl,[
|
$o = replace_macros($tpl,
|
||||||
|
[
|
||||||
'$user' => $a->user['nickname'],
|
'$user' => $a->user['nickname'],
|
||||||
'$lbl_upfile' => L10n::t('Upload File:'),
|
'$lbl_upfile' => L10n::t('Upload File:'),
|
||||||
'$lbl_profiles' => L10n::t('Select a profile:'),
|
'$lbl_profiles' => L10n::t('Select a profile:'),
|
||||||
|
@ -250,23 +246,24 @@ function profile_photo_content(App $a) {
|
||||||
'$submit' => L10n::t('Upload'),
|
'$submit' => L10n::t('Upload'),
|
||||||
'$profiles' => $profiles,
|
'$profiles' => $profiles,
|
||||||
'$form_security_token' => get_form_security_token("profile_photo"),
|
'$form_security_token' => get_form_security_token("profile_photo"),
|
||||||
'$select' => sprintf('%s %s', L10n::t('or'), ($newuser) ? '<a href="' . System::baseUrl() . '">' . L10n::t('skip this step') . '</a>' : '<a href="'. System::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . L10n::t('select a photo from your photo albums') . '</a>')
|
'$select' => sprintf('%s %s', L10n::t('or'),
|
||||||
|
($newuser) ? '<a href="' . System::baseUrl() . '">' . L10n::t('skip this step') . '</a>' : '<a href="' . System::baseUrl() . '/photos/' . $a->user['nickname'] . '">' . L10n::t('select a photo from your photo albums') . '</a>')
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
}
|
} else {
|
||||||
else {
|
$filename = $imagecrop['hash'] . '-' . $imagecrop['resolution'] . '.' . $imagecrop['ext'];
|
||||||
$filename = $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'] . '.'.$a->config['imagecrop_ext'];
|
|
||||||
$tpl = get_markup_template("cropbody.tpl");
|
$tpl = get_markup_template("cropbody.tpl");
|
||||||
$o = replace_macros($tpl,[
|
$o = replace_macros($tpl,
|
||||||
'$filename' => $filename,
|
[
|
||||||
'$profile' => intval($_REQUEST['profile']),
|
'$filename' => $filename,
|
||||||
'$resource' => $a->config['imagecrop'] . '-' . $a->config['imagecrop_resolution'],
|
'$profile' => intval($_REQUEST['profile']),
|
||||||
|
'$resource' => $imagecrop['hash'] . '-' . $imagecrop['resolution'],
|
||||||
'$image_url' => System::baseUrl() . '/photo/' . $filename,
|
'$image_url' => System::baseUrl() . '/photo/' . $filename,
|
||||||
'$title' => L10n::t('Crop Image'),
|
'$title' => L10n::t('Crop Image'),
|
||||||
'$desc' => L10n::t('Please adjust the image cropping for optimum viewing.'),
|
'$desc' => L10n::t('Please adjust the image cropping for optimum viewing.'),
|
||||||
'$form_security_token' => get_form_security_token("profile_photo"),
|
'$form_security_token' => get_form_security_token("profile_photo"),
|
||||||
'$done' => L10n::t('Done Editing')
|
'$done' => L10n::t('Done Editing')
|
||||||
]);
|
]);
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
@ -274,10 +271,10 @@ function profile_photo_content(App $a) {
|
||||||
return; // NOTREACHED
|
return; // NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function profile_photo_crop_ui_head(App $a, Image $Image)
|
||||||
function profile_photo_crop_ui_head(App $a, Image $Image) {
|
{
|
||||||
$max_length = Config::get('system','max_image_length');
|
$max_length = Config::get('system', 'max_image_length');
|
||||||
if (! $max_length) {
|
if (!$max_length) {
|
||||||
$max_length = MAX_IMAGE_LENGTH;
|
$max_length = MAX_IMAGE_LENGTH;
|
||||||
}
|
}
|
||||||
if ($max_length > 0) {
|
if ($max_length > 0) {
|
||||||
|
@ -318,10 +315,14 @@ function profile_photo_crop_ui_head(App $a, Image $Image) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$a->config['imagecrop'] = $hash;
|
|
||||||
$a->config['imagecrop_resolution'] = $smallest;
|
|
||||||
$a->config['imagecrop_ext'] = $Image->getExt();
|
|
||||||
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
|
$a->page['htmlhead'] .= replace_macros(get_markup_template("crophead.tpl"), []);
|
||||||
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), []);
|
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), []);
|
||||||
return;
|
|
||||||
|
$imagecrop = [
|
||||||
|
'hash' => $hash,
|
||||||
|
'resolution' => $smallest,
|
||||||
|
'ext' => $Image->getExt(),
|
||||||
|
];
|
||||||
|
|
||||||
|
return $imagecrop;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ function redir_init(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (remote_user()) {
|
if (remote_user()) {
|
||||||
$host = substr(System::baseUrl() . ($a->path ? '/' . $a->path : ''), strpos(System::baseUrl(), '://') + 3);
|
$host = substr(System::baseUrl() . ($a->urlpath ? '/' . $a->urlpath : ''), strpos(System::baseUrl(), '://') + 3);
|
||||||
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
|
$remotehost = substr($contact['addr'], strpos($contact['addr'], '@') + 1);
|
||||||
|
|
||||||
// On a local instance we have to check if the local user has already authenticated
|
// On a local instance we have to check if the local user has already authenticated
|
||||||
|
|
|
@ -21,8 +21,6 @@ function register_post(App $a)
|
||||||
{
|
{
|
||||||
check_form_security_token_redirectOnErr('/register', 'register');
|
check_form_security_token_redirectOnErr('/register', 'register');
|
||||||
|
|
||||||
global $lang;
|
|
||||||
|
|
||||||
$verified = 0;
|
$verified = 0;
|
||||||
$blocked = 1;
|
$blocked = 1;
|
||||||
|
|
||||||
|
@ -37,7 +35,7 @@ function register_post(App $a)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($a->config['register_policy']) {
|
switch (Config::get('config', 'register_policy')) {
|
||||||
case REGISTER_OPEN:
|
case REGISTER_OPEN:
|
||||||
$blocked = 0;
|
$blocked = 0;
|
||||||
$verified = 1;
|
$verified = 1;
|
||||||
|
@ -50,7 +48,7 @@ function register_post(App $a)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
case REGISTER_CLOSED:
|
case REGISTER_CLOSED:
|
||||||
if ((!x($_SESSION, 'authenticated') && (!x($_SESSION, 'administrator')))) {
|
if (empty($_SESSION['authenticated']) && empty($_SESSION['administrator'])) {
|
||||||
notice(L10n::t('Permission denied.') . EOL);
|
notice(L10n::t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +74,7 @@ function register_post(App $a)
|
||||||
|
|
||||||
$user = $result['user'];
|
$user = $result['user'];
|
||||||
|
|
||||||
if ($netpublish && $a->config['register_policy'] != REGISTER_APPROVE) {
|
if ($netpublish && intval(Config::get('config', 'register_policy')) !== REGISTER_APPROVE) {
|
||||||
$url = System::baseUrl() . '/profile/' . $user['nickname'];
|
$url = System::baseUrl() . '/profile/' . $user['nickname'];
|
||||||
Worker::add(PRIORITY_LOW, "Directory", $url);
|
Worker::add(PRIORITY_LOW, "Directory", $url);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +83,7 @@ function register_post(App $a)
|
||||||
$num_invites = Config::get('system', 'number_invites');
|
$num_invites = Config::get('system', 'number_invites');
|
||||||
$invite_id = ((x($_POST, 'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
|
$invite_id = ((x($_POST, 'invite_id')) ? notags(trim($_POST['invite_id'])) : '');
|
||||||
|
|
||||||
if ($a->config['register_policy'] == REGISTER_OPEN) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN) {
|
||||||
if ($using_invites && $invite_id) {
|
if ($using_invites && $invite_id) {
|
||||||
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
|
q("delete * from register where hash = '%s' limit 1", dbesc($invite_id));
|
||||||
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
PConfig::set($user['uid'], 'system', 'invites_remaining', $num_invites);
|
||||||
|
@ -94,7 +92,7 @@ function register_post(App $a)
|
||||||
// Only send a password mail when the password wasn't manually provided
|
// Only send a password mail when the password wasn't manually provided
|
||||||
if (!x($_POST, 'password1') || !x($_POST, 'confirm')) {
|
if (!x($_POST, 'password1') || !x($_POST, 'confirm')) {
|
||||||
$res = User::sendRegisterOpenEmail(
|
$res = User::sendRegisterOpenEmail(
|
||||||
$user['email'], $a->config['sitename'], System::baseUrl(), $user['username'], $result['password']);
|
$user['email'], Config::get('config', 'sitename'), System::baseUrl(), $user['username'], $result['password']);
|
||||||
|
|
||||||
if ($res) {
|
if ($res) {
|
||||||
info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
|
info(L10n::t('Registration successful. Please check your email for further instructions.') . EOL);
|
||||||
|
@ -111,8 +109,8 @@ function register_post(App $a)
|
||||||
info(L10n::t('Registration successful.') . EOL);
|
info(L10n::t('Registration successful.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway(System::baseUrl());
|
||||||
}
|
}
|
||||||
} elseif ($a->config['register_policy'] == REGISTER_APPROVE) {
|
} elseif (intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE) {
|
||||||
if (!strlen($a->config['admin_email'])) {
|
if (!strlen(Config::get('config', 'admin_email'))) {
|
||||||
notice(L10n::t('Your registration can not be processed.') . EOL);
|
notice(L10n::t('Your registration can not be processed.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway(System::baseUrl());
|
||||||
}
|
}
|
||||||
|
@ -123,7 +121,7 @@ function register_post(App $a)
|
||||||
dbesc(DateTimeFormat::utcNow()),
|
dbesc(DateTimeFormat::utcNow()),
|
||||||
intval($user['uid']),
|
intval($user['uid']),
|
||||||
dbesc($result['password']),
|
dbesc($result['password']),
|
||||||
dbesc($lang),
|
dbesc(Config::get('system', 'language')),
|
||||||
dbesc($_POST['permonlybox'])
|
dbesc($_POST['permonlybox'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -134,7 +132,7 @@ function register_post(App $a)
|
||||||
}
|
}
|
||||||
|
|
||||||
// send email to admins
|
// send email to admins
|
||||||
$admin_mail_list = "'" . implode("','", array_map("dbesc", explode(",", str_replace(" ", "", $a->config['admin_email'])))) . "'";
|
$admin_mail_list = "'" . implode("','", array_map("dbesc", explode(",", str_replace(" ", "", Config::get('config', 'admin_email'))))) . "'";
|
||||||
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
|
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
|
||||||
$admin_mail_list
|
$admin_mail_list
|
||||||
);
|
);
|
||||||
|
@ -158,7 +156,7 @@ function register_post(App $a)
|
||||||
}
|
}
|
||||||
// send notification to the user, that the registration is pending
|
// send notification to the user, that the registration is pending
|
||||||
User::sendRegisterPendingEmail(
|
User::sendRegisterPendingEmail(
|
||||||
$user['email'], $a->config['sitename'], $user['username']);
|
$user['email'], Config::get('config', 'sitename'), $user['username']);
|
||||||
|
|
||||||
info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
|
info(L10n::t('Your registration is pending approval by the site owner.') . EOL);
|
||||||
goaway(System::baseUrl());
|
goaway(System::baseUrl());
|
||||||
|
@ -179,7 +177,7 @@ function register_content(App $a)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((!local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
|
if ((!local_user()) && (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED)) {
|
||||||
notice("Permission denied." . EOL);
|
notice("Permission denied." . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -258,7 +256,7 @@ function register_content(App $a)
|
||||||
$o = replace_macros($tpl, [
|
$o = replace_macros($tpl, [
|
||||||
'$oidhtml' => $oidhtml,
|
'$oidhtml' => $oidhtml,
|
||||||
'$invitations' => Config::get('system', 'invitation_only'),
|
'$invitations' => Config::get('system', 'invitation_only'),
|
||||||
'$permonly' => $a->config['register_policy'] == REGISTER_APPROVE,
|
'$permonly' => intval(Config::get('config', 'register_policy')) === REGISTER_APPROVE,
|
||||||
'$permonlybox' => ['permonlybox', L10n::t('Note for the admin'), '', L10n::t('Leave a message for the admin, why you want to join this node')],
|
'$permonlybox' => ['permonlybox', L10n::t('Note for the admin'), '', L10n::t('Leave a message for the admin, why you want to join this node')],
|
||||||
'$invite_desc' => L10n::t('Membership on this site is by invitation only.'),
|
'$invite_desc' => L10n::t('Membership on this site is by invitation only.'),
|
||||||
'$invite_label' => L10n::t('Your invitation code: '),
|
'$invite_label' => L10n::t('Your invitation code: '),
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file mod/regmod.php
|
* @file mod/regmod.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
|
@ -57,7 +58,7 @@ function user_allow($hash)
|
||||||
|
|
||||||
$res = User::sendRegisterOpenEmail(
|
$res = User::sendRegisterOpenEmail(
|
||||||
$user[0]['email'],
|
$user[0]['email'],
|
||||||
$a->config['sitename'],
|
Config::get('config', 'sitename'),
|
||||||
System::baseUrl(),
|
System::baseUrl(),
|
||||||
$user[0]['username'],
|
$user[0]['username'],
|
||||||
$register[0]['password']);
|
$register[0]['password']);
|
||||||
|
@ -96,11 +97,9 @@ function user_deny($hash)
|
||||||
|
|
||||||
function regmod_content(App $a)
|
function regmod_content(App $a)
|
||||||
{
|
{
|
||||||
global $lang;
|
|
||||||
|
|
||||||
if (!local_user()) {
|
if (!local_user()) {
|
||||||
info(L10n::t('Please login.') . EOL);
|
info(L10n::t('Please login.') . EOL);
|
||||||
$o = '<br /><br />' . Login::form($a->query_string, $a->config['register_policy'] == REGISTER_CLOSED ? 0 : 1);
|
$o = '<br /><br />' . Login::form($a->query_string, intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED ? 0 : 1);
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* @file mod/removeme.php
|
* @file mod/removeme.php
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Model\User;
|
|
||||||
use Friendica\Database\DBM;
|
use Friendica\Database\DBM;
|
||||||
|
use Friendica\Model\User;
|
||||||
|
|
||||||
require_once 'include/enotify.php';
|
require_once 'include/enotify.php';
|
||||||
|
|
||||||
|
@ -34,7 +36,7 @@ function removeme_post(App $a)
|
||||||
|
|
||||||
// send notification to admins so that they can clean um the backups
|
// send notification to admins so that they can clean um the backups
|
||||||
// send email to admins
|
// send email to admins
|
||||||
$admin_mails = explode(",", str_replace(" ", "", $a->config['admin_email']));
|
$admin_mails = explode(",", str_replace(" ", "", Config::get('config', 'admin_email')));
|
||||||
foreach ($admin_mails as $mail) {
|
foreach ($admin_mails as $mail) {
|
||||||
$admin = dba::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
|
$admin = dba::selectFirst('user', ['uid', 'language', 'email'], ['email' => $mail]);
|
||||||
if (!DBM::is_result($admin)) {
|
if (!DBM::is_result($admin)) {
|
||||||
|
|
|
@ -26,14 +26,12 @@ use Friendica\Util\Temporal;
|
||||||
function get_theme_config_file($theme)
|
function get_theme_config_file($theme)
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
if (!empty($a->theme_info['extends'])) {
|
$base_theme = defaults($a->theme_info, 'extends');
|
||||||
$base_theme = $a->theme_info['extends'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists("view/theme/$theme/config.php")) {
|
if (file_exists("view/theme/$theme/config.php")) {
|
||||||
return "view/theme/$theme/config.php";
|
return "view/theme/$theme/config.php";
|
||||||
}
|
}
|
||||||
if (!empty($base_theme) && file_exists("view/theme/$base_theme/config.php")) {
|
if ($base_theme && file_exists("view/theme/$base_theme/config.php")) {
|
||||||
return "view/theme/$base_theme/config.php";
|
return "view/theme/$base_theme/config.php";
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -511,9 +509,8 @@ function settings_post(App $a)
|
||||||
$err .= L10n::t('Invalid email.');
|
$err .= L10n::t('Invalid email.');
|
||||||
}
|
}
|
||||||
// ensure new email is not the admin mail
|
// ensure new email is not the admin mail
|
||||||
//if ((x($a->config, 'admin_email')) && (strcasecmp($email, $a->config['admin_email']) == 0)) {
|
if (Config::get('config', 'admin_email')) {
|
||||||
if (x($a->config, 'admin_email')) {
|
$adminlist = explode(",", str_replace(" ", "", strtolower(Config::get('config', 'admin_email'))));
|
||||||
$adminlist = explode(",", str_replace(" ", "", strtolower($a->config['admin_email'])));
|
|
||||||
if (in_array(strtolower($email), $adminlist)) {
|
if (in_array(strtolower($email), $adminlist)) {
|
||||||
$err .= L10n::t('Cannot change to that email.');
|
$err .= L10n::t('Cannot change to that email.');
|
||||||
$email = $a->user['email'];
|
$email = $a->user['email'];
|
||||||
|
|
|
@ -17,10 +17,10 @@ function statistics_json_init(App $a) {
|
||||||
}
|
}
|
||||||
|
|
||||||
$statistics = [
|
$statistics = [
|
||||||
"name" => $a->config["sitename"],
|
"name" => Config::get('config', 'sitename'),
|
||||||
"network" => FRIENDICA_PLATFORM,
|
"network" => FRIENDICA_PLATFORM,
|
||||||
"version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
|
"version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION,
|
||||||
"registrations_open" => ($a->config['register_policy'] != 0),
|
"registrations_open" => intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED,
|
||||||
"total_users" => Config::get('nodeinfo', 'total_users'),
|
"total_users" => Config::get('nodeinfo', 'total_users'),
|
||||||
"active_users_halfyear" => Config::get('nodeinfo', 'active_users_halfyear'),
|
"active_users_halfyear" => Config::get('nodeinfo', 'active_users_halfyear'),
|
||||||
"active_users_monthly" => Config::get('nodeinfo', 'active_users_monthly'),
|
"active_users_monthly" => Config::get('nodeinfo', 'active_users_monthly'),
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Friendica\Core\UserImport;
|
||||||
|
|
||||||
function uimport_post(App $a)
|
function uimport_post(App $a)
|
||||||
{
|
{
|
||||||
switch ($a->config['register_policy']) {
|
switch (Config::get('config', 'register_policy')) {
|
||||||
case REGISTER_OPEN:
|
case REGISTER_OPEN:
|
||||||
$blocked = 0;
|
$blocked = 0;
|
||||||
$verified = 1;
|
$verified = 1;
|
||||||
|
@ -42,7 +42,7 @@ function uimport_post(App $a)
|
||||||
|
|
||||||
function uimport_content(App $a) {
|
function uimport_content(App $a) {
|
||||||
|
|
||||||
if ((!local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {
|
if ((!local_user()) && (intval(Config::get('config', 'register_policy')) === REGISTER_CLOSED)) {
|
||||||
notice("Permission denied." . EOL);
|
notice("Permission denied." . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
364
src/App.php
364
src/App.php
|
@ -4,7 +4,6 @@
|
||||||
*/
|
*/
|
||||||
namespace Friendica;
|
namespace Friendica;
|
||||||
|
|
||||||
use Friendica\Core\Cache;
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
|
@ -17,6 +16,7 @@ use Detection\MobileDetect;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
require_once 'boot.php';
|
require_once 'boot.php';
|
||||||
|
require_once 'include/dba.php';
|
||||||
require_once 'include/text.php';
|
require_once 'include/text.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,15 +34,27 @@ require_once 'include/text.php';
|
||||||
*/
|
*/
|
||||||
class App
|
class App
|
||||||
{
|
{
|
||||||
const MODE_NORMAL = 0;
|
const MODE_LOCALCONFIGPRESENT = 1;
|
||||||
const MODE_INSTALL = 1;
|
const MODE_DBAVAILABLE = 2;
|
||||||
const MODE_MAINTENANCE = 2;
|
const MODE_DBCONFIGAVAILABLE = 4;
|
||||||
|
const MODE_MAINTENANCEDISABLED = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 2008.08 Use App->isInstallMode() instead to check for install mode.
|
||||||
|
*/
|
||||||
|
const MODE_INSTALL = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 2008.08 Use the precise mode constant to check for a specific capability instead.
|
||||||
|
*/
|
||||||
|
const MODE_NORMAL = App::MODE_LOCALCONFIGPRESENT | App::MODE_DBAVAILABLE | App::MODE_DBCONFIGAVAILABLE | App::MODE_MAINTENANCEDISABLED;
|
||||||
|
|
||||||
public $module_loaded = false;
|
public $module_loaded = false;
|
||||||
public $module_class = null;
|
public $module_class = null;
|
||||||
public $query_string;
|
public $query_string = '';
|
||||||
public $config;
|
public $config = [];
|
||||||
public $page;
|
public $page = [];
|
||||||
|
public $pager = [];
|
||||||
public $page_offset;
|
public $page_offset;
|
||||||
public $profile;
|
public $profile;
|
||||||
public $profile_uid;
|
public $profile_uid;
|
||||||
|
@ -54,16 +66,15 @@ class App
|
||||||
public $content;
|
public $content;
|
||||||
public $data = [];
|
public $data = [];
|
||||||
public $error = false;
|
public $error = false;
|
||||||
public $cmd;
|
public $cmd = '';
|
||||||
public $argv;
|
public $argv;
|
||||||
public $argc;
|
public $argc;
|
||||||
public $module;
|
public $module;
|
||||||
public $mode = App::MODE_NORMAL;
|
public $mode = App::MODE_INSTALL;
|
||||||
public $pager;
|
|
||||||
public $strings;
|
public $strings;
|
||||||
public $basepath;
|
public $basepath;
|
||||||
public $path;
|
public $urlpath;
|
||||||
public $hooks;
|
public $hooks = [];
|
||||||
public $timezone;
|
public $timezone;
|
||||||
public $interactive = true;
|
public $interactive = true;
|
||||||
public $addons;
|
public $addons;
|
||||||
|
@ -127,7 +138,6 @@ class App
|
||||||
private $curl_code;
|
private $curl_code;
|
||||||
private $curl_content_type;
|
private $curl_content_type;
|
||||||
private $curl_headers;
|
private $curl_headers;
|
||||||
private static $a;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief App constructor.
|
* @brief App constructor.
|
||||||
|
@ -136,21 +146,32 @@ class App
|
||||||
*/
|
*/
|
||||||
public function __construct($basepath)
|
public function __construct($basepath)
|
||||||
{
|
{
|
||||||
global $default_timezone;
|
|
||||||
|
|
||||||
if (!static::directory_usable($basepath, false)) {
|
if (!static::directory_usable($basepath, false)) {
|
||||||
throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
|
throw new Exception('Basepath ' . $basepath . ' isn\'t usable.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BaseObject::setApp($this);
|
||||||
|
|
||||||
$this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
|
$this->basepath = rtrim($basepath, DIRECTORY_SEPARATOR);
|
||||||
|
|
||||||
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
|
// The order of the following calls is important to ensure proper initialization
|
||||||
include $this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php';
|
$this->loadConfigFiles();
|
||||||
|
|
||||||
|
$this->loadDatabase();
|
||||||
|
|
||||||
|
$this->determineMode();
|
||||||
|
|
||||||
|
$this->determineUrlPath();
|
||||||
|
|
||||||
|
Config::load();
|
||||||
|
|
||||||
|
if ($this->mode & self::MODE_DBAVAILABLE) {
|
||||||
|
Core\Addon::loadHooks();
|
||||||
|
|
||||||
|
$this->loadAddonConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->timezone = ((x($default_timezone)) ? $default_timezone : 'UTC');
|
$this->loadDefaultTimezone();
|
||||||
|
|
||||||
date_default_timezone_set($this->timezone);
|
|
||||||
|
|
||||||
$this->performance['start'] = microtime(true);
|
$this->performance['start'] = microtime(true);
|
||||||
$this->performance['database'] = 0;
|
$this->performance['database'] = 0;
|
||||||
|
@ -173,8 +194,6 @@ class App
|
||||||
$this->callstack['rendering'] = [];
|
$this->callstack['rendering'] = [];
|
||||||
$this->callstack['parser'] = [];
|
$this->callstack['parser'] = [];
|
||||||
|
|
||||||
$this->config = [];
|
|
||||||
|
|
||||||
$this->page = [
|
$this->page = [
|
||||||
'aside' => '',
|
'aside' => '',
|
||||||
'bottom' => '',
|
'bottom' => '',
|
||||||
|
@ -189,10 +208,6 @@ class App
|
||||||
'title' => ''
|
'title' => ''
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->pager = [];
|
|
||||||
|
|
||||||
$this->query_string = '';
|
|
||||||
|
|
||||||
$this->process_id = System::processID('log');
|
$this->process_id = System::processID('log');
|
||||||
|
|
||||||
set_time_limit(0);
|
set_time_limit(0);
|
||||||
|
@ -218,16 +233,6 @@ class App
|
||||||
if (x($_SERVER, 'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
|
if (x($_SERVER, 'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) {
|
||||||
$this->hostname .= ':' . $_SERVER['SERVER_PORT'];
|
$this->hostname .= ':' . $_SERVER['SERVER_PORT'];
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Figure out if we are running at the top of a domain
|
|
||||||
* or in a sub-directory and adjust accordingly
|
|
||||||
*/
|
|
||||||
|
|
||||||
/// @TODO This kind of escaping breaks syntax-highlightning on CoolEdit (Midnight Commander)
|
|
||||||
$path = trim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
|
|
||||||
if (isset($path) && strlen($path) && ($path != $this->path)) {
|
|
||||||
$this->path = $path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_include_path(
|
set_include_path(
|
||||||
|
@ -238,19 +243,16 @@ class App
|
||||||
|
|
||||||
if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === 'pagename=') {
|
if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === 'pagename=') {
|
||||||
$this->query_string = substr($_SERVER['QUERY_STRING'], 9);
|
$this->query_string = substr($_SERVER['QUERY_STRING'], 9);
|
||||||
|
|
||||||
// removing trailing / - maybe a nginx problem
|
|
||||||
$this->query_string = ltrim($this->query_string, '/');
|
|
||||||
} elseif ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === 'q=') {
|
} elseif ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === 'q=') {
|
||||||
$this->query_string = substr($_SERVER['QUERY_STRING'], 2);
|
$this->query_string = substr($_SERVER['QUERY_STRING'], 2);
|
||||||
|
|
||||||
// removing trailing / - maybe a nginx problem
|
|
||||||
$this->query_string = ltrim($this->query_string, '/');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x($_GET, 'pagename')) {
|
// removing trailing / - maybe a nginx problem
|
||||||
|
$this->query_string = ltrim($this->query_string, '/');
|
||||||
|
|
||||||
|
if (!empty($_GET['pagename'])) {
|
||||||
$this->cmd = trim($_GET['pagename'], '/\\');
|
$this->cmd = trim($_GET['pagename'], '/\\');
|
||||||
} elseif (x($_GET, 'q')) {
|
} elseif (!empty($_GET['q'])) {
|
||||||
$this->cmd = trim($_GET['q'], '/\\');
|
$this->cmd = trim($_GET['q'], '/\\');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,16 +313,251 @@ class App
|
||||||
|
|
||||||
// Register template engines
|
// Register template engines
|
||||||
$this->register_template_engine('Friendica\Render\FriendicaSmartyEngine');
|
$this->register_template_engine('Friendica\Render\FriendicaSmartyEngine');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the configuration file which contains our DB credentials.
|
* Load the configuration files
|
||||||
* Ignore errors. If the file doesn't exist or is empty, we are running in
|
*
|
||||||
* installation mode. *
|
* First loads the default value for all the configuration keys, then the legacy configuration files, then the
|
||||||
|
* expected local.ini.php
|
||||||
|
*/
|
||||||
|
private function loadConfigFiles()
|
||||||
|
{
|
||||||
|
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.ini.php');
|
||||||
|
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'settings.ini.php');
|
||||||
|
|
||||||
|
// Legacy .htconfig.php support
|
||||||
|
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
|
||||||
|
$a = $this;
|
||||||
|
include $this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Legacy .htconfig.php support
|
||||||
|
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php')) {
|
||||||
|
$a = $this;
|
||||||
|
|
||||||
|
include $this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php';
|
||||||
|
|
||||||
|
$this->setConfigValue('database', 'hostname', $db_host);
|
||||||
|
$this->setConfigValue('database', 'username', $db_user);
|
||||||
|
$this->setConfigValue('database', 'password', $db_pass);
|
||||||
|
$this->setConfigValue('database', 'database', $db_data);
|
||||||
|
if (isset($a->config['system']['db_charset'])) {
|
||||||
|
$this->setConfigValue('database', 'charset', $a->config['system']['db_charset']);
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
|
|
||||||
|
if (isset($default_timezone)) {
|
||||||
|
$this->setConfigValue('system', 'default_timezone', $default_timezone);
|
||||||
|
unset($default_timezone);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($pidfile)) {
|
||||||
|
$this->setConfigValue('system', 'pidfile', $pidfile);
|
||||||
|
unset($pidfile);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($lang)) {
|
||||||
|
$this->setConfigValue('system', 'language', $lang);
|
||||||
|
unset($lang);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')) {
|
||||||
|
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to load the specified configuration file into the App->config array.
|
||||||
|
* Overwrites previously set values.
|
||||||
|
*
|
||||||
|
* The config format is INI and the template for configuration files is the following:
|
||||||
|
*
|
||||||
|
* <?php return <<<INI
|
||||||
|
*
|
||||||
|
* [section]
|
||||||
|
* key = value
|
||||||
|
*
|
||||||
|
* INI;
|
||||||
|
* // Keep this line
|
||||||
|
*
|
||||||
|
* @param type $filepath
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function loadConfigFile($filepath)
|
||||||
|
{
|
||||||
|
if (!file_exists($filepath)) {
|
||||||
|
throw new Exception('Error parsing non-existent config file ' . $filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
$contents = include($filepath);
|
||||||
|
|
||||||
|
$config = parse_ini_string($contents, true, INI_SCANNER_TYPED);
|
||||||
|
|
||||||
|
if ($config === false) {
|
||||||
|
throw new Exception('Error parsing config file ' . $filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($config as $category => $values) {
|
||||||
|
foreach ($values as $key => $value) {
|
||||||
|
$this->setConfigValue($category, $key, $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads addons configuration files
|
||||||
|
*
|
||||||
|
* First loads all activated addons default configuration throught the load_config hook, then load the local.ini.php
|
||||||
|
* again to overwrite potential local addon configuration.
|
||||||
|
*/
|
||||||
|
private function loadAddonConfig()
|
||||||
|
{
|
||||||
|
// Loads addons default config
|
||||||
|
Core\Addon::callHooks('load_config');
|
||||||
|
|
||||||
|
// Load the local addon config file to overwritten default addon config values
|
||||||
|
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php')) {
|
||||||
|
$this->loadConfigFile($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'addon.ini.php');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the default timezone
|
||||||
|
*
|
||||||
|
* Include support for legacy $default_timezone
|
||||||
|
*
|
||||||
|
* @global string $default_timezone
|
||||||
|
*/
|
||||||
|
private function loadDefaultTimezone()
|
||||||
|
{
|
||||||
|
if ($this->getConfigValue('system', 'default_timezone')) {
|
||||||
|
$this->timezone = $this->getConfigValue('system', 'default_timezone');
|
||||||
|
} else {
|
||||||
|
global $default_timezone;
|
||||||
|
$this->timezone = !empty($default_timezone) ? $default_timezone : 'UTC';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->timezone) {
|
||||||
|
date_default_timezone_set($this->timezone);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Figure out if we are running at the top of a domain or in a sub-directory and adjust accordingly
|
||||||
|
*/
|
||||||
|
private function determineUrlPath()
|
||||||
|
{
|
||||||
|
$this->urlpath = $this->getConfigValue('system', 'urlpath');
|
||||||
|
|
||||||
|
/* SCRIPT_URL gives /path/to/friendica/module/parameter
|
||||||
|
* QUERY_STRING gives pagename=module/parameter
|
||||||
|
*
|
||||||
|
* To get /path/to/friendica we perform dirname() for as many levels as there are slashes in the QUERY_STRING
|
||||||
*/
|
*/
|
||||||
$this->mode = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? App::MODE_NORMAL : App::MODE_INSTALL);
|
if (!empty($_SERVER['SCRIPT_URL'])) {
|
||||||
|
// Module
|
||||||
|
if (!empty($_SERVER['QUERY_STRING'])) {
|
||||||
|
$path = trim(dirname($_SERVER['SCRIPT_URL'], substr_count(trim($_SERVER['QUERY_STRING'], '/'), '/') + 1), '/');
|
||||||
|
} else {
|
||||||
|
// Root page
|
||||||
|
$path = trim($_SERVER['SCRIPT_URL'], '/');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($path && $path != $this->urlpath) {
|
||||||
|
$this->urlpath = $path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
self::$a = $this;
|
/**
|
||||||
|
* Sets the App mode
|
||||||
|
*
|
||||||
|
* - App::MODE_INSTALL : Either the database connection can't be established or the config table doesn't exist
|
||||||
|
* - App::MODE_MAINTENANCE: The maintenance mode has been set
|
||||||
|
* - App::MODE_NORMAL : Normal run with all features enabled
|
||||||
|
*
|
||||||
|
* @return type
|
||||||
|
*/
|
||||||
|
private function determineMode()
|
||||||
|
{
|
||||||
|
$this->mode = 0;
|
||||||
|
|
||||||
|
if (!file_exists($this->basepath . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'local.ini.php')
|
||||||
|
&& !file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htconfig.php')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= App::MODE_LOCALCONFIGPRESENT;
|
||||||
|
|
||||||
|
if (!\dba::connected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= App::MODE_DBAVAILABLE;
|
||||||
|
|
||||||
|
if (\dba::fetch_first("SHOW TABLES LIKE 'config'") === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= App::MODE_DBCONFIGAVAILABLE;
|
||||||
|
|
||||||
|
if (Config::get('system', 'maintenance')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mode |= App::MODE_MAINTENANCEDISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadDatabase()
|
||||||
|
{
|
||||||
|
if (\dba::connected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$db_host = $this->getConfigValue('database', 'hostname');
|
||||||
|
$db_user = $this->getConfigValue('database', 'username');
|
||||||
|
$db_pass = $this->getConfigValue('database', 'password');
|
||||||
|
$db_data = $this->getConfigValue('database', 'database');
|
||||||
|
$charset = $this->getConfigValue('database', 'charset');
|
||||||
|
|
||||||
|
// Use environment variables for mysql if they are set beforehand
|
||||||
|
if (!empty(getenv('MYSQL_HOST'))
|
||||||
|
&& (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER')))
|
||||||
|
&& getenv('MYSQL_PASSWORD') !== false
|
||||||
|
&& !empty(getenv('MYSQL_DATABASE')))
|
||||||
|
{
|
||||||
|
$db_host = getenv('MYSQL_HOST');
|
||||||
|
if (!empty(getenv('MYSQL_PORT'))) {
|
||||||
|
$db_host .= ':' . getenv('MYSQL_PORT');
|
||||||
|
}
|
||||||
|
if (!empty(getenv('MYSQL_USERNAME'))) {
|
||||||
|
$db_user = getenv('MYSQL_USERNAME');
|
||||||
|
} else {
|
||||||
|
$db_user = getenv('MYSQL_USER');
|
||||||
|
}
|
||||||
|
$db_pass = (string) getenv('MYSQL_PASSWORD');
|
||||||
|
$db_data = getenv('MYSQL_DATABASE');
|
||||||
|
}
|
||||||
|
|
||||||
|
$stamp1 = microtime(true);
|
||||||
|
|
||||||
|
\dba::connect($db_host, $db_user, $db_pass, $db_data, $charset);
|
||||||
|
unset($db_host, $db_user, $db_pass, $db_data, $charset);
|
||||||
|
|
||||||
|
$this->save_timestamp($stamp1, 'network');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install mode is when the local config file is missing or the DB schema hasn't been installed yet.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isInstallMode()
|
||||||
|
{
|
||||||
|
return !($this->mode & App::MODE_LOCALCONFIGPRESENT) || !($this->mode & App::MODE_DBCONFIGAVAILABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -413,7 +650,7 @@ class App
|
||||||
$this->hostname = Config::get('config', 'hostname');
|
$this->hostname = Config::get('config', 'hostname');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $scheme . '://' . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
|
return $scheme . '://' . $this->hostname . (!empty($this->urlpath) ? '/' . $this->urlpath : '' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -441,7 +678,7 @@ class App
|
||||||
$hostname .= ':' . $parsed['port'];
|
$hostname .= ':' . $parsed['port'];
|
||||||
}
|
}
|
||||||
if (x($parsed, 'path')) {
|
if (x($parsed, 'path')) {
|
||||||
$this->path = trim($parsed['path'], '\\/');
|
$this->urlpath = trim($parsed['path'], '\\/');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
|
if (file_exists($this->basepath . DIRECTORY_SEPARATOR . '.htpreconfig.php')) {
|
||||||
|
@ -469,7 +706,7 @@ class App
|
||||||
|
|
||||||
public function get_path()
|
public function get_path()
|
||||||
{
|
{
|
||||||
return $this->path;
|
return $this->urlpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function set_pager_total($n)
|
public function set_pager_total($n)
|
||||||
|
@ -775,7 +1012,7 @@ class App
|
||||||
*
|
*
|
||||||
* @return bool Is the limit reached?
|
* @return bool Is the limit reached?
|
||||||
*/
|
*/
|
||||||
public function max_processes_reached()
|
public function isMaxProcessesReached()
|
||||||
{
|
{
|
||||||
// Deactivated, needs more investigating if this check really makes sense
|
// Deactivated, needs more investigating if this check really makes sense
|
||||||
return false;
|
return false;
|
||||||
|
@ -855,7 +1092,7 @@ class App
|
||||||
*
|
*
|
||||||
* @return bool Is the load reached?
|
* @return bool Is the load reached?
|
||||||
*/
|
*/
|
||||||
public function maxload_reached()
|
public function isMaxLoadReached()
|
||||||
{
|
{
|
||||||
if ($this->is_backend()) {
|
if ($this->is_backend()) {
|
||||||
$process = 'backend';
|
$process = 'backend';
|
||||||
|
@ -1107,21 +1344,6 @@ class App
|
||||||
return $sender_email;
|
return $sender_email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @note Checks, if the App is in the Maintenance-Mode
|
|
||||||
*
|
|
||||||
* @return boolean
|
|
||||||
*/
|
|
||||||
public function checkMaintenanceMode()
|
|
||||||
{
|
|
||||||
if (Config::get('system', 'maintenance')) {
|
|
||||||
$this->mode = App::MODE_MAINTENANCE;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current theme name.
|
* Returns the current theme name.
|
||||||
*
|
*
|
||||||
|
@ -1129,7 +1351,7 @@ class App
|
||||||
*/
|
*/
|
||||||
public function getCurrentTheme()
|
public function getCurrentTheme()
|
||||||
{
|
{
|
||||||
if ($this->mode == App::MODE_INSTALL) {
|
if ($this->isInstallMode()) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,12 +24,10 @@ class BaseObject
|
||||||
*/
|
*/
|
||||||
public static function getApp()
|
public static function getApp()
|
||||||
{
|
{
|
||||||
if (self::$app) {
|
if (empty(self::$app)) {
|
||||||
return self::$app;
|
self::$app = new App(dirname(__DIR__));
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$app = get_app();
|
|
||||||
|
|
||||||
return self::$app;
|
return self::$app;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +38,7 @@ class BaseObject
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function setApp($app)
|
public static function setApp(App $app)
|
||||||
{
|
{
|
||||||
self::$app = $app;
|
self::$app = $app;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Nav
|
||||||
$nav['home'] = [$homelink, L10n::t('Home'), '', L10n::t('Home Page')];
|
$nav['home'] = [$homelink, L10n::t('Home'), '', L10n::t('Home Page')];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($a->config['register_policy'] == REGISTER_OPEN) && (! local_user()) && (! remote_user())) {
|
if (intval(Config::get('config', 'register_policy')) === REGISTER_OPEN && !local_user() && !remote_user()) {
|
||||||
$nav['register'] = ['register', L10n::t('Register'), '', L10n::t('Create an account')];
|
$nav['register'] = ['register', L10n::t('Register'), '', L10n::t('Create an account')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file src/Content/Text/BBCode.php
|
* @file src/Content/Text/BBCode.php
|
||||||
*/
|
*/
|
||||||
|
@ -16,7 +15,6 @@ use Friendica\Core\Addon;
|
||||||
use Friendica\Core\Cache;
|
use Friendica\Core\Cache;
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\L10n;
|
use Friendica\Core\L10n;
|
||||||
use Friendica\Core\PConfig;
|
|
||||||
use Friendica\Core\Protocol;
|
use Friendica\Core\Protocol;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
|
@ -449,7 +447,7 @@ class BBCode extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function limitBodySize($body)
|
public static function limitBodySize($body)
|
||||||
{
|
{
|
||||||
$maxlen = get_max_import_size();
|
$maxlen = Config::get('config', 'max_import_size', 0);
|
||||||
|
|
||||||
// If the length of the body, including the embedded images, is smaller
|
// If the length of the body, including the embedded images, is smaller
|
||||||
// than the maximum, then don't waste time looking for the images
|
// than the maximum, then don't waste time looking for the images
|
||||||
|
|
|
@ -549,8 +549,6 @@ class HTML
|
||||||
|
|
||||||
public static function toPlaintext($html, $wraplength = 75, $compact = false)
|
public static function toPlaintext($html, $wraplength = 75, $compact = false)
|
||||||
{
|
{
|
||||||
global $lang;
|
|
||||||
|
|
||||||
$message = str_replace("\r", "", $html);
|
$message = str_replace("\r", "", $html);
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
|
|
|
@ -24,20 +24,20 @@ class CacheDriverFactory
|
||||||
|
|
||||||
switch ($driver) {
|
switch ($driver) {
|
||||||
case 'memcache':
|
case 'memcache':
|
||||||
$memcache_host = Config::get('system', 'memcache_host', '127.0.0.1');
|
$memcache_host = Config::get('system', 'memcache_host');
|
||||||
$memcache_port = Config::get('system', 'memcache_port', 11211);
|
$memcache_port = Config::get('system', 'memcache_port');
|
||||||
|
|
||||||
return new MemcacheCacheDriver($memcache_host, $memcache_port);
|
return new MemcacheCacheDriver($memcache_host, $memcache_port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'memcached':
|
case 'memcached':
|
||||||
$memcached_hosts = Config::get('system', 'memcached_hosts', [['127.0.0.1', 11211]]);
|
$memcached_hosts = Config::get('system', 'memcached_hosts');
|
||||||
|
|
||||||
return new MemcachedCacheDriver($memcached_hosts);
|
return new MemcachedCacheDriver($memcached_hosts);
|
||||||
break;
|
break;
|
||||||
case 'redis':
|
case 'redis':
|
||||||
$redis_host = Config::get('system', 'redis_host', '127.0.0.1');
|
$redis_host = Config::get('system', 'redis_host');
|
||||||
$redis_port = Config::get('system', 'redis_port', 6379);
|
$redis_port = Config::get('system', 'redis_port');
|
||||||
|
|
||||||
return new RedisCacheDriver($redis_host, $redis_port);
|
return new RedisCacheDriver($redis_host, $redis_port);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -22,6 +22,16 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
|
||||||
*/
|
*/
|
||||||
private $memcached;
|
private $memcached;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Due to limitations of the INI format, the expected configuration for Memcached servers is the following:
|
||||||
|
* array {
|
||||||
|
* 0 => "hostname, port(, weight)",
|
||||||
|
* 1 => ...
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* @param array $memcached_hosts
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
public function __construct(array $memcached_hosts)
|
public function __construct(array $memcached_hosts)
|
||||||
{
|
{
|
||||||
if (!class_exists('Memcached', false)) {
|
if (!class_exists('Memcached', false)) {
|
||||||
|
@ -30,6 +40,12 @@ class MemcachedCacheDriver extends AbstractCacheDriver implements IMemoryCacheDr
|
||||||
|
|
||||||
$this->memcached = new Memcached();
|
$this->memcached = new Memcached();
|
||||||
|
|
||||||
|
array_walk($memcached_hosts, function (&$value) {
|
||||||
|
if (is_string($value)) {
|
||||||
|
$value = array_map('trim', explode(',', $value));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$this->memcached->addServers($memcached_hosts);
|
$this->memcached->addServers($memcached_hosts);
|
||||||
|
|
||||||
if (count($this->memcached->getServerList()) == 0) {
|
if (count($this->memcached->getServerList()) == 0) {
|
||||||
|
|
|
@ -29,6 +29,11 @@ class Config extends BaseObject
|
||||||
|
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (self::getApp()->getConfigValue('system', 'config_adapter') == 'preload') {
|
if (self::getApp()->getConfigValue('system', 'config_adapter') == 'preload') {
|
||||||
self::$adapter = new Config\PreloadConfigAdapter();
|
self::$adapter = new Config\PreloadConfigAdapter();
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,6 +53,11 @@ class Config extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function load($family = "config")
|
public static function load($family = "config")
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init();
|
self::init();
|
||||||
}
|
}
|
||||||
|
@ -76,6 +86,11 @@ class Config extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function get($family, $key, $default_value = null, $refresh = false)
|
public static function get($family, $key, $default_value = null, $refresh = false)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet, fallback to file config
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return self::getApp()->getConfigValue($family, $key, $default_value);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init();
|
self::init();
|
||||||
}
|
}
|
||||||
|
@ -99,6 +114,11 @@ class Config extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function set($family, $key, $value)
|
public static function set($family, $key, $value)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init();
|
self::init();
|
||||||
}
|
}
|
||||||
|
@ -119,6 +139,11 @@ class Config extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function delete($family, $key)
|
public static function delete($family, $key)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init();
|
self::init();
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,11 +66,17 @@ class JITConfigAdapter extends BaseObject implements IConfigAdapter
|
||||||
$this->in_db[$cat][$k] = true;
|
$this->in_db[$cat][$k] = true;
|
||||||
return $value;
|
return $value;
|
||||||
} elseif (isset($a->config[$cat][$k])) {
|
} elseif (isset($a->config[$cat][$k])) {
|
||||||
// Assign the value (mostly) from the .htconfig.php to the cache
|
// Assign the value (mostly) from config/local.ini.php file to the cache
|
||||||
$this->cache[$cat][$k] = $a->config[$cat][$k];
|
$this->cache[$cat][$k] = $a->config[$cat][$k];
|
||||||
$this->in_db[$cat][$k] = false;
|
$this->in_db[$cat][$k] = false;
|
||||||
|
|
||||||
return $a->config[$cat][$k];
|
return $a->config[$cat][$k];
|
||||||
|
} elseif (isset($a->config[$k])) {
|
||||||
|
// Assign the value (mostly) from config/local.ini.php file to the cache
|
||||||
|
$this->cache[$k] = $a->config[$k];
|
||||||
|
$this->in_db[$k] = false;
|
||||||
|
|
||||||
|
return $a->config[$k];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cache[$cat][$k] = '!<unset>!';
|
$this->cache[$cat][$k] = '!<unset>!';
|
||||||
|
|
|
@ -54,12 +54,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->mode === App::MODE_INSTALL) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Friendica isn\'t properly installed yet.');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nurl = normalise_link($this->getArgument(0));
|
$nurl = normalise_link($this->getArgument(0));
|
||||||
|
|
|
@ -5,8 +5,10 @@ namespace Friendica\Core\Console;
|
||||||
use Asika\SimpleConsole\Console;
|
use Asika\SimpleConsole\Console;
|
||||||
use dba;
|
use dba;
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
|
use Friendica\Core\Config;
|
||||||
use Friendica\Core\Install;
|
use Friendica\Core\Install;
|
||||||
use Friendica\Core\Theme;
|
use Friendica\Core\Theme;
|
||||||
|
use RuntimeException;
|
||||||
|
|
||||||
require_once 'mod/install.php';
|
require_once 'mod/install.php';
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
@ -18,8 +20,8 @@ class AutomaticInstallation extends Console
|
||||||
return <<<HELP
|
return <<<HELP
|
||||||
Installation - Install Friendica automatically
|
Installation - Install Friendica automatically
|
||||||
Synopsis
|
Synopsis
|
||||||
bin/console autoinstall [-h|--help|-?] [-v] [-a]
|
bin/console autoinstall [-h|--help|-?] [-v] [-a]
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Installs Friendica with data based on the htconfig.php file
|
Installs Friendica with data based on the htconfig.php file
|
||||||
|
|
||||||
|
@ -62,7 +64,7 @@ HELP;
|
||||||
$errorMessage = $this->extractErrors($checkResults['basic']);
|
$errorMessage = $this->extractErrors($checkResults['basic']);
|
||||||
|
|
||||||
if ($errorMessage !== '') {
|
if ($errorMessage !== '') {
|
||||||
throw new \RuntimeException($errorMessage);
|
throw new RuntimeException($errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out(" Complete!\n\n");
|
$this->out(" Complete!\n\n");
|
||||||
|
@ -75,7 +77,7 @@ HELP;
|
||||||
$errorMessage = $this->extractErrors($checkResults['db']);
|
$errorMessage = $this->extractErrors($checkResults['db']);
|
||||||
|
|
||||||
if ($errorMessage !== '') {
|
if ($errorMessage !== '') {
|
||||||
throw new \RuntimeException($errorMessage);
|
throw new RuntimeException($errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out(" Complete!\n\n");
|
$this->out(" Complete!\n\n");
|
||||||
|
@ -86,15 +88,15 @@ HELP;
|
||||||
$checkResults['data'] = Install::installDatabaseStructure();
|
$checkResults['data'] = Install::installDatabaseStructure();
|
||||||
|
|
||||||
if ($checkResults['data'] !== '') {
|
if ($checkResults['data'] !== '') {
|
||||||
throw new \RuntimeException("ERROR: DB Database creation error. Is the DB empty?\n");
|
throw new RuntimeException("ERROR: DB Database creation error. Is the DB empty?\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out(" Complete!\n\n");
|
$this->out(" Complete!\n\n");
|
||||||
|
|
||||||
// Install theme
|
// Install theme
|
||||||
$this->out("Installing theme\n");
|
$this->out("Installing theme\n");
|
||||||
if (!empty($a->config['system']['theme'])) {
|
if (!empty(Config::get('system', 'theme'))) {
|
||||||
Theme::install($a->config['system']['theme']);
|
Theme::install(Config::get('system', 'theme'));
|
||||||
$this->out(" Complete\n\n");
|
$this->out(" Complete\n\n");
|
||||||
} else {
|
} else {
|
||||||
$this->out(" Theme setting is empty. Please check the file htconfig.php\n\n");
|
$this->out(" Theme setting is empty. Please check the file htconfig.php\n\n");
|
||||||
|
@ -103,7 +105,7 @@ HELP;
|
||||||
// Copy config file
|
// Copy config file
|
||||||
$this->out("Saving config file...\n");
|
$this->out("Saving config file...\n");
|
||||||
if ($config_file != '.htconfig.php' && !copy($config_file, '.htconfig.php')) {
|
if ($config_file != '.htconfig.php' && !copy($config_file, '.htconfig.php')) {
|
||||||
throw new \RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '.htconfig.php' manually.\n");
|
throw new RuntimeException("ERROR: Saving config file failed. Please copy '$config_file' to '.htconfig.php' manually.\n");
|
||||||
}
|
}
|
||||||
$this->out(" Complete!\n\n");
|
$this->out(" Complete!\n\n");
|
||||||
$this->out("\nInstallation is finished\n");
|
$this->out("\nInstallation is finished\n");
|
||||||
|
@ -121,14 +123,14 @@ HELP;
|
||||||
|
|
||||||
Install::checkFunctions($checks);
|
Install::checkFunctions($checks);
|
||||||
Install::checkImagick($checks);
|
Install::checkImagick($checks);
|
||||||
Install::checkHtConfig($checks);
|
Install::checkLocalIni($checks);
|
||||||
Install::checkSmarty3($checks);
|
Install::checkSmarty3($checks);
|
||||||
Install::checkKeys($checks);
|
Install::checkKeys($checks);
|
||||||
|
|
||||||
if (!empty($app->config['php_path'])) {
|
if (!empty(Config::get('config', 'php_path'))) {
|
||||||
Install::checkPHP($app->config['php_path'], $checks);
|
Install::checkPHP(Config::get('config', 'php_path'), $checks);
|
||||||
} else {
|
} else {
|
||||||
throw new \RuntimeException(" ERROR: The php_path is not set in the config. Please check the file .htconfig.php.\n");
|
throw new RuntimeException(" ERROR: The php_path is not set in the config.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->out(" NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.\n");
|
$this->out(" NOTICE: Not checking .htaccess/URL-Rewrite during CLI installation.\n");
|
||||||
|
|
|
@ -67,7 +67,7 @@ Description
|
||||||
Sets the value of the provided key in the category
|
Sets the value of the provided key in the category
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
Setting config entries which are manually set in .htconfig.php may result in
|
Setting config entries which are manually set in config/local.ini.php may result in
|
||||||
conflict between database settings and the manual startup settings.
|
conflict between database settings and the manual startup settings.
|
||||||
|
|
||||||
Options
|
Options
|
||||||
|
@ -92,32 +92,56 @@ HELP;
|
||||||
throw new CommandArgsException('Too many arguments');
|
throw new CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if (!($a->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
$result = dba::connect($db_host, $db_user, $db_pass, $db_data);
|
$this->out('Database isn\'t ready or populated yet, showing file config only');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->args) == 3) {
|
if (count($this->args) == 3) {
|
||||||
Core\Config::set($this->getArgument(0), $this->getArgument(1), $this->getArgument(2));
|
$cat = $this->getArgument(0);
|
||||||
$this->out("config[{$this->getArgument(0)}][{$this->getArgument(1)}] = " . Core\Config::get($this->getArgument(0),
|
$key = $this->getArgument(1);
|
||||||
$this->getArgument(1)));
|
$value = $this->getArgument(2);
|
||||||
|
|
||||||
|
if (is_array(Core\Config::get($cat, $key))) {
|
||||||
|
throw new \RuntimeException("$cat.$key is an array and can't be set using this command.");
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Core\Config::set($cat, $key, $value);
|
||||||
|
if ($result) {
|
||||||
|
$this->out("{$cat}.{$key} <= " .
|
||||||
|
Core\Config::get($cat, $key));
|
||||||
|
} else {
|
||||||
|
$this->out("Unable to set {$cat}.{$key}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->args) == 2) {
|
if (count($this->args) == 2) {
|
||||||
$this->out("config[{$this->getArgument(0)}][{$this->getArgument(1)}] = " . Core\Config::get($this->getArgument(0),
|
$cat = $this->getArgument(0);
|
||||||
$this->getArgument(1)));
|
$key = $this->getArgument(1);
|
||||||
|
$value = Core\Config::get($this->getArgument(0), $this->getArgument(1));
|
||||||
|
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
$this->out("{$cat}.{$key}[{$k}] => " . $v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->out("{$cat}.{$key} => " . $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->args) == 1) {
|
if (count($this->args) == 1) {
|
||||||
Core\Config::load($this->getArgument(0));
|
$cat = $this->getArgument(0);
|
||||||
|
Core\Config::load($cat);
|
||||||
|
|
||||||
$a = get_app();
|
if (!is_null($a->config[$cat])) {
|
||||||
if (!is_null($a->config[$this->getArgument(0)])) {
|
$this->out("[{$cat}]");
|
||||||
foreach ($a->config[$this->getArgument(0)] as $k => $x) {
|
foreach ($a->config[$cat] as $key => $value) {
|
||||||
$this->out("config[{$this->getArgument(0)}][{$k}] = " . $x);
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
$this->out("{$key}[{$k}] => " . $v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->out("{$key} => " . $value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->out('Config section ' . $this->getArgument(0) . ' returned nothing');
|
$this->out('Config section ' . $this->getArgument(0) . ' returned nothing');
|
||||||
|
@ -125,13 +149,29 @@ HELP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($this->args) == 0) {
|
if (count($this->args) == 0) {
|
||||||
$configs = dba::select('config');
|
Core\Config::load();
|
||||||
foreach ($configs as $config) {
|
|
||||||
$this->out("config[{$config['cat']}][{$config['k']}] = " . $config['v']);
|
if (Core\Config::get('system', 'config_adapter') == 'jit' && $a->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE) {
|
||||||
|
$this->out('Warning: The JIT (Just In Time) Config adapter doesn\'t support loading the entire configuration, showing file config only');
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($a->config as $cat => $section) {
|
||||||
|
if (is_array($section)) {
|
||||||
|
foreach ($section as $key => $value) {
|
||||||
|
if (is_array($value)) {
|
||||||
|
foreach ($value as $k => $v) {
|
||||||
|
$this->out("{$cat}.{$key}[{$k}] => " . $v);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->out("{$cat}.{$key} => " . $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$this->out("config.{$cat} => " . $section);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,11 +56,7 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if (!\dba::connected()) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
throw new \RuntimeException('Unable to connect to database');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->isInstallMode()) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact_id = Contact::getIdForURL($this->getArgument(0));
|
$contact_id = Contact::getIdForURL($this->getArgument(0));
|
||||||
|
|
|
@ -64,12 +64,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->isInstallMode()) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -64,12 +64,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->isInstallMode()) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Core\Config::load();
|
Core\Config::load();
|
||||||
|
|
|
@ -58,12 +58,8 @@ HELP;
|
||||||
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
|
||||||
}
|
}
|
||||||
|
|
||||||
require_once '.htconfig.php';
|
if ($a->isInstallMode()) {
|
||||||
$result = \dba::connect($db_host, $db_user, $db_pass, $db_data);
|
throw new \RuntimeException('Database isn\'t ready or populated yet');
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
|
||||||
|
|
||||||
if (!$result) {
|
|
||||||
throw new \RuntimeException('Unable to connect to database');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$nick = $this->getArgument(0);
|
$nick = $this->getArgument(0);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Install extends BaseObject
|
||||||
|
|
||||||
self::checkImagick($checks);
|
self::checkImagick($checks);
|
||||||
|
|
||||||
self::checkHtConfig($checks);
|
self::checkLocalIni($checks);
|
||||||
|
|
||||||
self::checkSmarty3($checks);
|
self::checkSmarty3($checks);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ class Install extends BaseObject
|
||||||
|
|
||||||
$checkspassed = array_reduce($checks,
|
$checkspassed = array_reduce($checks,
|
||||||
function ($v, $c) {
|
function ($v, $c) {
|
||||||
if ($c['require']) {
|
if (!empty($c['require'])) {
|
||||||
$v = $v && $c['status'];
|
$v = $v && $c['status'];
|
||||||
}
|
}
|
||||||
return $v;
|
return $v;
|
||||||
|
@ -66,7 +66,7 @@ class Install extends BaseObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the installation of Friendica in the given environment.
|
* Executes the installation of Friendica in the given environment.
|
||||||
* - Creates `.htconfig.php`
|
* - Creates `config/local.ini.php`
|
||||||
* - Installs Database Structure
|
* - Installs Database Structure
|
||||||
*
|
*
|
||||||
* @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica')
|
* @param string $urlpath Path based on the URL of Friendica (e.g. '/friendica')
|
||||||
|
@ -80,9 +80,9 @@ class Install extends BaseObject
|
||||||
* @param string $adminmail Mail-Adress of the administrator
|
* @param string $adminmail Mail-Adress of the administrator
|
||||||
* @param int $rino Rino-enabled (1 = true, 0 = false)
|
* @param int $rino Rino-enabled (1 = true, 0 = false)
|
||||||
*/
|
*/
|
||||||
public static function install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail, $rino = 1)
|
public static function install($urlpath, $dbhost, $dbuser, $dbpass, $dbdata, $phpath, $timezone, $language, $adminmail)
|
||||||
{
|
{
|
||||||
$tpl = get_markup_template('htconfig.tpl');
|
$tpl = get_markup_template('local.ini.tpl');
|
||||||
$txt = replace_macros($tpl,[
|
$txt = replace_macros($tpl,[
|
||||||
'$dbhost' => $dbhost,
|
'$dbhost' => $dbhost,
|
||||||
'$dbuser' => $dbuser,
|
'$dbuser' => $dbuser,
|
||||||
|
@ -93,10 +93,9 @@ class Install extends BaseObject
|
||||||
'$urlpath' => $urlpath,
|
'$urlpath' => $urlpath,
|
||||||
'$phpath' => $phpath,
|
'$phpath' => $phpath,
|
||||||
'$adminmail' => $adminmail,
|
'$adminmail' => $adminmail,
|
||||||
'$rino' => $rino
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$result = file_put_contents('.htconfig.php', $txt);
|
$result = file_put_contents('config/local.ini.php', $txt);
|
||||||
if (! $result) {
|
if (! $result) {
|
||||||
self::getApp()->data['txt'] = $txt;
|
self::getApp()->data['txt'] = $txt;
|
||||||
}
|
}
|
||||||
|
@ -303,27 +302,27 @@ class Install extends BaseObject
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ".htconfig.php" - Check
|
* "config/local.ini.php" - Check
|
||||||
*
|
*
|
||||||
* Checks if it's possible to create the ".htconfig.php"
|
* Checks if it's possible to create the "config/local.ini.php"
|
||||||
*
|
*
|
||||||
* @param array $checks The list of all checks (by-ref parameter!)
|
* @param array $checks The list of all checks (by-ref parameter!)
|
||||||
*/
|
*/
|
||||||
public static function checkHtConfig(&$checks)
|
public static function checkLocalIni(&$checks)
|
||||||
{
|
{
|
||||||
$status = true;
|
$status = true;
|
||||||
$help = "";
|
$help = "";
|
||||||
if ((file_exists('.htconfig.php') && !is_writable('.htconfig.php')) ||
|
if ((file_exists('config/local.ini.php') && !is_writable('config/local.ini.php')) ||
|
||||||
(!file_exists('.htconfig.php') && !is_writable('.'))) {
|
(!file_exists('config/local.ini.php') && !is_writable('.'))) {
|
||||||
|
|
||||||
$status = false;
|
$status = false;
|
||||||
$help = L10n::t('The web installer needs to be able to create a file called ".htconfig.php" in the top folder of your web server and it is unable to do so.') . EOL;
|
$help = L10n::t('The web installer needs to be able to create a file called "local.ini.php" in the "config" folder of your web server and it is unable to do so.') . EOL;
|
||||||
$help .= L10n::t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . EOL;
|
$help .= L10n::t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . EOL;
|
||||||
$help .= L10n::t('At the end of this procedure, we will give you a text to save in a file named .htconfig.php in your Friendica top folder.') . EOL;
|
$help .= L10n::t('At the end of this procedure, we will give you a text to save in a file named local.ini.php in your Friendica "config" folder.') . EOL;
|
||||||
$help .= L10n::t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.') . EOL;
|
$help .= L10n::t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.') . EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self::addCheck($checks, L10n::t('.htconfig.php is writable'), $status, false, $help);
|
self::addCheck($checks, L10n::t('config/local.ini.php is writable'), $status, false, $help);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +375,7 @@ class Install extends BaseObject
|
||||||
$error_msg = [];
|
$error_msg = [];
|
||||||
$error_msg['head'] = L10n::t('Error message from Curl when fetching');
|
$error_msg['head'] = L10n::t('Error message from Curl when fetching');
|
||||||
$error_msg['url'] = $test['redirect_url'];
|
$error_msg['url'] = $test['redirect_url'];
|
||||||
$error_msg['msg'] = $test['error'];
|
$error_msg['msg'] = defaults($test, 'error', '');
|
||||||
}
|
}
|
||||||
self::addCheck($checks, L10n::t('Url rewrite is working'), $status, true, $help, $error_msg);
|
self::addCheck($checks, L10n::t('Url rewrite is working'), $status, true, $help, $error_msg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -14,7 +14,7 @@ require_once 'include/dba.php';
|
||||||
* Provide Languange, Translation, and Localisation functions to the application
|
* Provide Languange, Translation, and Localisation functions to the application
|
||||||
* Localisation can be referred to by the numeronym L10N (as in: "L", followed by ten more letters, and then "N").
|
* Localisation can be referred to by the numeronym L10N (as in: "L", followed by ten more letters, and then "N").
|
||||||
*/
|
*/
|
||||||
class L10n
|
class L10n extends \Friendica\BaseObject
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
|
* @brief get the prefered language from the HTTP_ACCEPT_LANGUAGE header
|
||||||
|
@ -62,11 +62,11 @@ class L10n
|
||||||
*/
|
*/
|
||||||
public static function pushLang($language)
|
public static function pushLang($language)
|
||||||
{
|
{
|
||||||
global $lang, $a;
|
$a = self::getApp();
|
||||||
|
|
||||||
$a->langsave = $lang;
|
$a->langsave = Config::get('system', 'language');
|
||||||
|
|
||||||
if ($language === $lang) {
|
if ($language === $a->langsave) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ class L10n
|
||||||
}
|
}
|
||||||
$a->strings = [];
|
$a->strings = [];
|
||||||
self::loadTranslationTable($language);
|
self::loadTranslationTable($language);
|
||||||
$lang = $language;
|
Config::set('system', 'language', $language);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,9 +83,9 @@ class L10n
|
||||||
*/
|
*/
|
||||||
public static function popLang()
|
public static function popLang()
|
||||||
{
|
{
|
||||||
global $lang, $a;
|
$a = self::getApp();
|
||||||
|
|
||||||
if ($lang === $a->langsave) {
|
if (Config::get('system', 'language') === $a->langsave) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ class L10n
|
||||||
$a->strings = [];
|
$a->strings = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$lang = $a->langsave;
|
Config::set('system', 'language', $a->langsave);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +107,7 @@ class L10n
|
||||||
*/
|
*/
|
||||||
public static function loadTranslationTable($lang)
|
public static function loadTranslationTable($lang)
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = self::getApp();
|
||||||
|
|
||||||
$a->strings = [];
|
$a->strings = [];
|
||||||
// load enabled addons strings
|
// load enabled addons strings
|
||||||
|
@ -142,7 +142,7 @@ class L10n
|
||||||
*/
|
*/
|
||||||
public static function t($s, ...$vars)
|
public static function t($s, ...$vars)
|
||||||
{
|
{
|
||||||
$a = get_app();
|
$a = self::getApp();
|
||||||
|
|
||||||
if (empty($s)) {
|
if (empty($s)) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -173,7 +173,6 @@ class L10n
|
||||||
* - L10n::tt('Like', 'Likes', $count)
|
* - L10n::tt('Like', 'Likes', $count)
|
||||||
* - L10n::tt("%s user deleted", "%s users deleted", count($users))
|
* - L10n::tt("%s user deleted", "%s users deleted", count($users))
|
||||||
*
|
*
|
||||||
* @global type $lang
|
|
||||||
* @param string $singular
|
* @param string $singular
|
||||||
* @param string $plural
|
* @param string $plural
|
||||||
* @param int $count
|
* @param int $count
|
||||||
|
@ -181,10 +180,9 @@ class L10n
|
||||||
*/
|
*/
|
||||||
public static function tt($singular, $plural, $count)
|
public static function tt($singular, $plural, $count)
|
||||||
{
|
{
|
||||||
global $lang;
|
$lang = Config::get('system', 'language');
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
if (x($a->strings, $singular)) {
|
if (!empty($a->strings[$singular])) {
|
||||||
$t = $a->strings[$singular];
|
$t = $a->strings[$singular];
|
||||||
if (is_array($t)) {
|
if (is_array($t)) {
|
||||||
$plural_function = 'string_plural_select_' . str_replace('-', '_', $lang);
|
$plural_function = 'string_plural_select_' . str_replace('-', '_', $lang);
|
||||||
|
|
|
@ -613,7 +613,7 @@ class NotificationsManager extends BaseObject
|
||||||
// We have to distinguish between these two because they use different data.
|
// We have to distinguish between these two because they use different data.
|
||||||
// Contact suggestions
|
// Contact suggestions
|
||||||
if ($it['fid']) {
|
if ($it['fid']) {
|
||||||
$return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->get_hostname() . ((self::getApp()->path) ? '/' . self::getApp()->path : ''));
|
$return_addr = bin2hex(self::getApp()->user['nickname'] . '@' . self::getApp()->get_hostname() . ((self::getApp()->urlpath) ? '/' . self::getApp()->urlpath : ''));
|
||||||
|
|
||||||
$intro = [
|
$intro = [
|
||||||
'label' => 'friend_suggestion',
|
'label' => 'friend_suggestion',
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
namespace Friendica\Core;
|
namespace Friendica\Core;
|
||||||
|
|
||||||
use Friendica\BaseObject;
|
use Friendica\BaseObject;
|
||||||
use Friendica\Core\Config;
|
|
||||||
|
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
|
||||||
|
@ -29,7 +28,12 @@ class PConfig extends BaseObject
|
||||||
|
|
||||||
public static function init($uid)
|
public static function init($uid)
|
||||||
{
|
{
|
||||||
if (Config::get('system', 'config_adapter') == 'preload') {
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::getApp()->getConfigValue('system', 'config_adapter') == 'preload') {
|
||||||
self::$adapter = new Config\PreloadPConfigAdapter($uid);
|
self::$adapter = new Config\PreloadPConfigAdapter($uid);
|
||||||
} else {
|
} else {
|
||||||
self::$adapter = new Config\JITPConfigAdapter($uid);
|
self::$adapter = new Config\JITPConfigAdapter($uid);
|
||||||
|
@ -49,6 +53,11 @@ class PConfig extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function load($uid, $family)
|
public static function load($uid, $family)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init($uid);
|
self::init($uid);
|
||||||
}
|
}
|
||||||
|
@ -73,6 +82,11 @@ class PConfig extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function get($uid, $family, $key, $default_value = null, $refresh = false)
|
public static function get($uid, $family, $key, $default_value = null, $refresh = false)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init($uid);
|
self::init($uid);
|
||||||
}
|
}
|
||||||
|
@ -97,6 +111,11 @@ class PConfig extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function set($uid, $family, $key, $value)
|
public static function set($uid, $family, $key, $value)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init($uid);
|
self::init($uid);
|
||||||
}
|
}
|
||||||
|
@ -118,6 +137,11 @@ class PConfig extends BaseObject
|
||||||
*/
|
*/
|
||||||
public static function delete($uid, $family, $key)
|
public static function delete($uid, $family, $key)
|
||||||
{
|
{
|
||||||
|
// Database isn't ready or populated yet
|
||||||
|
if (!(self::getApp()->mode & \Friendica\App::MODE_DBCONFIGAVAILABLE)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty(self::$adapter)) {
|
if (empty(self::$adapter)) {
|
||||||
self::init($uid);
|
self::init($uid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,20 +85,6 @@ class System extends BaseObject
|
||||||
return implode(', ', $callstack2);
|
return implode(', ', $callstack2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Called from db initialisation when db is dead.
|
|
||||||
*/
|
|
||||||
static public function unavailable() {
|
|
||||||
echo <<< EOT
|
|
||||||
<html>
|
|
||||||
<head><title>System Unavailable</title></head>
|
|
||||||
<body>Apologies but this site is unavailable at the moment. Please try again later.</body>
|
|
||||||
</html>
|
|
||||||
EOT;
|
|
||||||
|
|
||||||
killme();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic XML return
|
* Generic XML return
|
||||||
* Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable
|
* Outputs a basic dfrn XML status structure to STDOUT, with a <status> variable
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Worker
|
||||||
self::$up_start = microtime(true);
|
self::$up_start = microtime(true);
|
||||||
|
|
||||||
// At first check the maximum load. We shouldn't continue with a high load
|
// At first check the maximum load. We shouldn't continue with a high load
|
||||||
if ($a->maxload_reached()) {
|
if ($a->isMaxLoadReached()) {
|
||||||
logger('Pre check: maximum load reached, quitting.', LOGGER_DEBUG);
|
logger('Pre check: maximum load reached, quitting.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ class Worker
|
||||||
}
|
}
|
||||||
|
|
||||||
// Possibly there are too much database processes that block the system
|
// Possibly there are too much database processes that block the system
|
||||||
if ($a->max_processes_reached()) {
|
if ($a->isMaxProcessesReached()) {
|
||||||
logger('Pre check: maximum processes reached, quitting.', LOGGER_DEBUG);
|
logger('Pre check: maximum processes reached, quitting.', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ class Worker
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constantly check the number of parallel database processes
|
// Constantly check the number of parallel database processes
|
||||||
if ($a->max_processes_reached()) {
|
if ($a->isMaxProcessesReached()) {
|
||||||
logger("Max processes reached for process ".$mypid, LOGGER_DEBUG);
|
logger("Max processes reached for process ".$mypid, LOGGER_DEBUG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ class DBStructure
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
//send the administrators an e-mail
|
//send the administrators an e-mail
|
||||||
$admin_mail_list = "'".implode("','", array_map(dbesc, explode(",", str_replace(" ", "", $a->config['admin_email']))))."'";
|
$admin_mail_list = "'".implode("','", array_map('dbesc', explode(",", str_replace(" ", "", Config::get('config', 'admin_email')))))."'";
|
||||||
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
|
$adminlist = q("SELECT uid, language, email FROM user WHERE email IN (%s)",
|
||||||
$admin_mail_list
|
$admin_mail_list
|
||||||
);
|
);
|
||||||
|
|
|
@ -1316,7 +1316,7 @@ class Contact extends BaseObject
|
||||||
|
|
||||||
if (($ret['network'] === NETWORK_DFRN) && !DBM::is_result($r)) {
|
if (($ret['network'] === NETWORK_DFRN) && !DBM::is_result($r)) {
|
||||||
if ($interactive) {
|
if ($interactive) {
|
||||||
if (strlen($a->path)) {
|
if (strlen($a->urlpath)) {
|
||||||
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
|
$myaddr = bin2hex(System::baseUrl() . '/profile/' . $a->user['nickname']);
|
||||||
} else {
|
} else {
|
||||||
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
|
$myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
|
||||||
|
|
|
@ -138,7 +138,7 @@ class Profile
|
||||||
$a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme');
|
$a->profile['mobile-theme'] = PConfig::get($a->profile['profile_uid'], 'system', 'mobile_theme');
|
||||||
$a->profile['network'] = NETWORK_DFRN;
|
$a->profile['network'] = NETWORK_DFRN;
|
||||||
|
|
||||||
$a->page['title'] = $a->profile['name'] . ' @ ' . $a->config['sitename'];
|
$a->page['title'] = $a->profile['name'] . ' @ ' . Config::get('config', 'sitename');
|
||||||
|
|
||||||
if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
|
if (!$profiledata && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
|
||||||
$_SESSION['theme'] = $a->profile['theme'];
|
$_SESSION['theme'] = $a->profile['theme'];
|
||||||
|
|
|
@ -454,8 +454,8 @@ class User
|
||||||
|
|
||||||
// Disallow somebody creating an account using openid that uses the admin email address,
|
// Disallow somebody creating an account using openid that uses the admin email address,
|
||||||
// since openid bypasses email verification. We'll allow it if there is not yet an admin account.
|
// since openid bypasses email verification. We'll allow it if there is not yet an admin account.
|
||||||
if (x($a->config, 'admin_email') && strlen($openid_url)) {
|
if (Config::get('config', 'admin_email') && strlen($openid_url)) {
|
||||||
$adminlist = explode(',', str_replace(' ', '', strtolower($a->config['admin_email'])));
|
$adminlist = explode(',', str_replace(' ', '', strtolower(Config::get('config', 'admin_email'))));
|
||||||
if (in_array(strtolower($email), $adminlist)) {
|
if (in_array(strtolower($email), $adminlist)) {
|
||||||
throw new Exception(L10n::t('Cannot use that email.'));
|
throw new Exception(L10n::t('Cannot use that email.'));
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Login extends BaseModule
|
||||||
goaway(self::getApp()->get_baseurl());
|
goaway(self::getApp()->get_baseurl());
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::form(self::getApp()->get_baseurl(), $a->config['register_policy'] != REGISTER_CLOSED);
|
return self::form(self::getApp()->get_baseurl(), intval(Config::get('config', 'register_policy')) !== REGISTER_CLOSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function post()
|
public static function post()
|
||||||
|
@ -266,7 +266,7 @@ class Login extends BaseModule
|
||||||
* @param string $return_url The url relative to the base the user should be sent
|
* @param string $return_url The url relative to the base the user should be sent
|
||||||
* back to after login completes
|
* back to after login completes
|
||||||
* @param bool $register If $register == true provide a registration link.
|
* @param bool $register If $register == true provide a registration link.
|
||||||
* This will most always depend on the value of $a->config['register_policy'].
|
* This will most always depend on the value of config.register_policy.
|
||||||
* @param array $hiddens optional
|
* @param array $hiddens optional
|
||||||
*
|
*
|
||||||
* @return string Returns the complete html for inserting into the page
|
* @return string Returns the complete html for inserting into the page
|
||||||
|
|
|
@ -80,7 +80,7 @@ class Magic extends BaseModule
|
||||||
'',
|
'',
|
||||||
$headers,
|
$headers,
|
||||||
$user['prvkey'],
|
$user['prvkey'],
|
||||||
'acct:' . $user['nickname'] . '@' . $a->get_hostname() . ($a->path ? '/' . $a->path : ''),
|
'acct:' . $user['nickname'] . '@' . $a->get_hostname() . ($a->urlpath ? '/' . $a->urlpath : ''),
|
||||||
false,
|
false,
|
||||||
true,
|
true,
|
||||||
'sha512'
|
'sha512'
|
||||||
|
|
|
@ -1269,7 +1269,7 @@ class OStatus
|
||||||
XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes);
|
XML::addElement($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes);
|
||||||
XML::addElement($doc, $root, "id", System::baseUrl() . "/profile/" . $owner["nick"]);
|
XML::addElement($doc, $root, "id", System::baseUrl() . "/profile/" . $owner["nick"]);
|
||||||
XML::addElement($doc, $root, "title", $title);
|
XML::addElement($doc, $root, "title", $title);
|
||||||
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], $a->config["sitename"]));
|
XML::addElement($doc, $root, "subtitle", sprintf("Updates from %s on %s", $owner["name"], Config::get('config', 'sitename')));
|
||||||
XML::addElement($doc, $root, "logo", $owner["photo"]);
|
XML::addElement($doc, $root, "logo", $owner["photo"]);
|
||||||
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
||||||
|
|
||||||
|
|
|
@ -559,9 +559,8 @@ class Network
|
||||||
*/
|
*/
|
||||||
public static function isUrlBlocked($url)
|
public static function isUrlBlocked($url)
|
||||||
{
|
{
|
||||||
$h = @parse_url($url);
|
$host = @parse_url($url, PHP_URL_HOST);
|
||||||
|
if (! $host) {
|
||||||
if (! $h) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -570,10 +569,8 @@ class Network
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$host = strtolower($h['host']);
|
|
||||||
|
|
||||||
foreach ($domain_blocklist as $domain_block) {
|
foreach ($domain_blocklist as $domain_block) {
|
||||||
if (strtolower($domain_block['domain']) == $host) {
|
if (strcasecmp($domain_block['domain'], $host) === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,10 @@ use Friendica\Util\Network;
|
||||||
* Checking the upstream version is optional (opt-in) and can be done to either
|
* Checking the upstream version is optional (opt-in) and can be done to either
|
||||||
* the master or the develop branch in the repository.
|
* the master or the develop branch in the repository.
|
||||||
*/
|
*/
|
||||||
class CheckVersion {
|
class CheckVersion
|
||||||
public static function execute() {
|
{
|
||||||
global $a;
|
public static function execute()
|
||||||
|
{
|
||||||
logger('checkversion: start');
|
logger('checkversion: start');
|
||||||
|
|
||||||
$checkurl = Config::get('system', 'check_new_version_url', 'none');
|
$checkurl = Config::get('system', 'check_new_version_url', 'none');
|
||||||
|
|
|
@ -13,9 +13,11 @@ use dba;
|
||||||
|
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
|
||||||
Class Cron {
|
class Cron
|
||||||
public static function execute($parameter = '', $generation = 0) {
|
{
|
||||||
global $a;
|
public static function execute($parameter = '', $generation = 0)
|
||||||
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
// Poll contacts with specific parameters
|
// Poll contacts with specific parameters
|
||||||
if (!empty($parameter)) {
|
if (!empty($parameter)) {
|
||||||
|
|
|
@ -24,7 +24,7 @@ class CronJobs
|
||||||
{
|
{
|
||||||
public static function execute($command = '')
|
public static function execute($command = '')
|
||||||
{
|
{
|
||||||
global $a;
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
// No parameter set? So return
|
// No parameter set? So return
|
||||||
if ($command == '') {
|
if ($command == '') {
|
||||||
|
|
|
@ -60,8 +60,6 @@ class DBClean {
|
||||||
* 10: Old conversations.
|
* 10: Old conversations.
|
||||||
*/
|
*/
|
||||||
private static function removeOrphans($stage) {
|
private static function removeOrphans($stage) {
|
||||||
global $db;
|
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
|
|
||||||
// We split the deletion in many small tasks
|
// We split the deletion in many small tasks
|
||||||
|
|
|
@ -7,9 +7,11 @@ namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Core\Config;
|
use Friendica\Core\Config;
|
||||||
|
|
||||||
class DBUpdate {
|
class DBUpdate
|
||||||
public static function execute() {
|
{
|
||||||
$a = get_app();
|
public static function execute()
|
||||||
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
// We are deleting the latest dbupdate entry.
|
// We are deleting the latest dbupdate entry.
|
||||||
// This is done to avoid endless loops because the update was interupted.
|
// This is done to avoid endless loops because the update was interupted.
|
||||||
|
|
|
@ -15,7 +15,8 @@ use Friendica\Util\DateTimeFormat;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use dba;
|
use dba;
|
||||||
|
|
||||||
class DiscoverPoCo {
|
class DiscoverPoCo
|
||||||
|
{
|
||||||
/// @todo Clean up this mess of a parameter hell and split it in several classes
|
/// @todo Clean up this mess of a parameter hell and split it in several classes
|
||||||
public static function execute($command = '', $param1 = '', $param2 = '', $param3 = '', $param4 = '')
|
public static function execute($command = '', $param1 = '', $param2 = '', $param3 = '', $param4 = '')
|
||||||
{
|
{
|
||||||
|
@ -276,8 +277,6 @@ class DiscoverPoCo {
|
||||||
// It is not removed since I hope that there will be a successor.
|
// It is not removed since I hope that there will be a successor.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$a = get_app();
|
|
||||||
|
|
||||||
$url = "http://gstools.org/api/users_search/".urlencode($search);
|
$url = "http://gstools.org/api/users_search/".urlencode($search);
|
||||||
|
|
||||||
$result = Network::curl($url);
|
$result = Network::curl($url);
|
||||||
|
|
|
@ -15,9 +15,11 @@ use dba;
|
||||||
|
|
||||||
require_once 'include/dba.php';
|
require_once 'include/dba.php';
|
||||||
|
|
||||||
class Expire {
|
class Expire
|
||||||
public static function execute($param = '', $hook_name = '') {
|
{
|
||||||
global $a;
|
public static function execute($param = '', $hook_name = '')
|
||||||
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,11 @@ namespace Friendica\Worker;
|
||||||
|
|
||||||
use Friendica\Core\Addon;
|
use Friendica\Core\Addon;
|
||||||
|
|
||||||
Class ForkHook {
|
Class ForkHook
|
||||||
public static function execute($name, $hook, $data) {
|
{
|
||||||
global $a;
|
public static function execute($name, $hook, $data)
|
||||||
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
Addon::callSingleHook($a, $name, $hook, $data);
|
Addon::callSingleHook($a, $name, $hook, $data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,9 +48,11 @@ require_once 'include/items.php';
|
||||||
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
|
* and ITEM_ID is the id of the item in the database that needs to be sent to others.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Notifier {
|
class Notifier
|
||||||
public static function execute($cmd, $item_id) {
|
{
|
||||||
global $a;
|
public static function execute($cmd, $item_id)
|
||||||
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
logger('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG);
|
logger('notifier: invoked: '.$cmd.': '.$item_id, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ require_once 'include/dba.php';
|
||||||
|
|
||||||
class OnePoll
|
class OnePoll
|
||||||
{
|
{
|
||||||
public static function execute($contact_id = 0, $command = '') {
|
public static function execute($contact_id = 0, $command = '')
|
||||||
global $a;
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
|
@ -634,7 +635,8 @@ class OnePoll
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function RemoveReply($subject) {
|
private static function RemoveReply($subject)
|
||||||
|
{
|
||||||
while (in_array(strtolower(substr($subject, 0, 3)), ["re:", "aw:"])) {
|
while (in_array(strtolower(substr($subject, 0, 3)), ["re:", "aw:"])) {
|
||||||
$subject = trim(substr($subject, 4));
|
$subject = trim(substr($subject, 4));
|
||||||
}
|
}
|
||||||
|
@ -648,7 +650,8 @@ class OnePoll
|
||||||
* @param array $contact The personal contact entry
|
* @param array $contact The personal contact entry
|
||||||
* @param array $fields The fields that are updated
|
* @param array $fields The fields that are updated
|
||||||
*/
|
*/
|
||||||
private static function updateContact($contact, $fields) {
|
private static function updateContact($contact, $fields)
|
||||||
|
{
|
||||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||||
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
dba::update('contact', $fields, ['uid' => 0, 'nurl' => $contact['nurl']]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,8 @@ use dba;
|
||||||
|
|
||||||
require_once 'include/items.php';
|
require_once 'include/items.php';
|
||||||
|
|
||||||
class PubSubPublish {
|
class PubSubPublish
|
||||||
|
{
|
||||||
public static function execute($pubsubpublish_id = 0)
|
public static function execute($pubsubpublish_id = 0)
|
||||||
{
|
{
|
||||||
if ($pubsubpublish_id == 0) {
|
if ($pubsubpublish_id == 0) {
|
||||||
|
@ -25,8 +26,9 @@ class PubSubPublish {
|
||||||
self::publish($pubsubpublish_id);
|
self::publish($pubsubpublish_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function publish($id) {
|
private static function publish($id)
|
||||||
global $a;
|
{
|
||||||
|
$a = \Friendica\BaseObject::getApp();
|
||||||
|
|
||||||
$subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
|
$subscriber = dba::selectFirst('push_subscriber', [], ['id' => $id]);
|
||||||
if (!DBM::is_result($subscriber)) {
|
if (!DBM::is_result($subscriber)) {
|
||||||
|
|
|
@ -25,8 +25,6 @@ class Queue
|
||||||
{
|
{
|
||||||
public static function execute($queue_id = 0)
|
public static function execute($queue_id = 0)
|
||||||
{
|
{
|
||||||
global $a;
|
|
||||||
|
|
||||||
$cachekey_deadguy = 'queue_run:deadguy:';
|
$cachekey_deadguy = 'queue_run:deadguy:';
|
||||||
$cachekey_server = 'queue_run:server:';
|
$cachekey_server = 'queue_run:server:';
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue