Browse Source

Merge branch 'develop' into issue/#3062

* develop: (68 commits)
  Added documentation
  update to the translation
  update to the translations
  translation docs now contain basic usage of the Transifex client
  - Replace TinyMCE-enabled filebrowser.tpl by filebrowser_plain.tpl content
  - Remove misc TinyMCE mentions in docs and minifyjs
  - Remove $theme_richtext_editor boot var - Remove "richtext" feature - Remove fix_mce_lf() function - Remove nomce parameter
  - Remove TinyMCE mentions in themes
  - Remove tinyMCE mentions or convert to addeditortext() - Remove $editselect template value
  Remove tinyMCE libraries
  limit the description of the meta tag to 160 characters in /mod/display
  Improved handling of non string values in the config
  Bugfix: Caching of non string cache values now works.
  Reformatted stuff, improved query
  Auto-focus first input field of modal when shown
  Use cache instead of config for storing last proc_run time
  Some added logging
  Bugfix for masses of php warnings
  Rearranged the logging
  Some changed logging
  ...

# Conflicts:
#	view/theme/frost-mobile/js/theme.js
#	view/theme/frost/js/theme.js
pull/3072/head
Hypolite Petovan 4 years ago
parent
commit
c38a5e443d
438 changed files with 94863 additions and 130353 deletions
  1. +3
    -0
      .gitignore
  2. +9
    -0
      .tx/config
  3. +30
    -1
      README.translate.md
  4. +31
    -28
      boot.php
  5. +47
    -56
      database.sql
  6. +13
    -13
      doc/FAQ.md
  7. +9
    -10
      doc/Settings.md
  8. +6
    -21
      doc/Text_editor.md
  9. +8
    -0
      doc/htconfig.md
  10. +30
    -0
      doc/translations.md
  11. +48
    -28
      include/Core/Config.php
  12. +10
    -2
      include/Probe.php
  13. +2
    -0
      include/acl_selectors.php
  14. +11
    -5
      include/api.php
  15. +1
    -1
      include/cache.php
  16. +9
    -8
      include/cli_startup.php
  17. +1
    -1
      include/contact_widgets.php
  18. +0
    -11
      include/conversation.php
  19. +4
    -2
      include/create_shadowentry.php
  20. +12
    -8
      include/cron.php
  21. +3
    -3
      include/cronhooks.php
  22. +3
    -2
      include/cronjobs.php
  23. +4
    -2
      include/datetime.php
  24. +62
    -0
      include/dba.php
  25. +1
    -2
      include/dbclean.php
  26. +129
    -62
      include/dbstructure.php
  27. +3
    -2
      include/dbupdate.php
  28. +76
    -50
      include/delivery.php
  29. +1
    -1
      include/dfrn.php
  30. +3
    -3
      include/diaspora.php
  31. +3
    -5
      include/directory.php
  32. +3
    -3
      include/discover_poco.php
  33. +3
    -3
      include/event.php
  34. +8
    -7
      include/expire.php
  35. +4
    -15
      include/features.php
  36. +3
    -2
      include/gprobe.php
  37. +16
    -9
      include/identity.php
  38. +6
    -1
      include/network.php
  39. +131
    -109
      include/notifier.php
  40. +3
    -2
      include/onepoll.php
  41. +3
    -1
      include/ostatus.php
  42. +5
    -3
      include/pgettext.php
  43. +2
    -2
      include/photos.php
  44. +2
    -1
      include/plaintext.php
  45. +105
    -25
      include/poller.php
  46. +1
    -1
      include/post_update.php
  47. +1
    -2
      include/pubsubpublish.php
  48. +4
    -2
      include/queue.php
  49. +4
    -2
      include/remove_contact.php
  50. +3
    -2
      include/session.php
  51. +4
    -2
      include/shadowupdate.php
  52. +1
    -1
      include/socgraph.php
  53. +4
    -2
      include/spool_post.php
  54. +4
    -2
      include/tagupdate.php
  55. +8
    -13
      include/text.php
  56. +4
    -2
      include/threadupdate.php
  57. +3
    -2
      include/update_gcontact.php
  58. +3
    -2
      index.php
  59. +54
    -59
      js/acl.js
  60. +37
    -66
      js/autocomplete.js
  61. +0
    -57
      js/main.js
  62. +0
    -8
      library/mcefixes/README
  63. +0
    -268
      library/mcefixes/plugins.bbcode.editor_plugin_src.js
  64. BIN
      library/mcefixes/themes.advanced.img.icons.gif
  65. +0
    -117
      library/mcefixes/themes.advanced.skins.default.dialog.css
  66. +0
    -213
      library/mcefixes/themes.advanced.skins.default.ui.css
  67. +0
    -504
      library/tinymce/LICENSE.TXT
  68. +0
    -477
      library/tinymce/changelog.txt
  69. +0
    -101
      library/tinymce/examples/accessibility.html
  70. +0
    -105
      library/tinymce/examples/css/content.css
  71. +0
    -53
      library/tinymce/examples/css/word.css
  72. +0
    -111
      library/tinymce/examples/custom_formats.html
  73. +0
    -101
      library/tinymce/examples/full.html
  74. +0
    -10
      library/tinymce/examples/index.html
  75. +0
    -9
      library/tinymce/examples/lists/image_list.js
  76. +0
    -10
      library/tinymce/examples/lists/link_list.js
  77. +0
    -14
      library/tinymce/examples/lists/media_list.js
  78. +0
    -9
      library/tinymce/examples/lists/template_list.js
  79. BIN
      library/tinymce/examples/media/logo.jpg
  80. BIN
      library/tinymce/examples/media/logo_over.jpg
  81. BIN
      library/tinymce/examples/media/sample.avi
  82. BIN
      library/tinymce/examples/media/sample.dcr
  83. BIN
      library/tinymce/examples/media/sample.flv
  84. BIN
      library/tinymce/examples/media/sample.mov
  85. +0
    -1
      library/tinymce/examples/media/sample.ram
  86. BIN
      library/tinymce/examples/media/sample.rm
  87. BIN
      library/tinymce/examples/media/sample.swf
  88. +0
    -18
      library/tinymce/examples/menu.html
  89. +0
    -47
      library/tinymce/examples/simple.html
  90. +0
    -216
      library/tinymce/examples/skins.html
  91. +0
    -15
      library/tinymce/examples/templates/layout1.htm
  92. +0
    -1
      library/tinymce/examples/templates/snippet1.htm
  93. +0
    -72
      library/tinymce/examples/word.html
  94. +0
    -1
      library/tinymce/jscripts/tiny_mce/langs/en.js
  95. +0
    -504
      library/tinymce/jscripts/tiny_mce/license.txt
  96. +0
    -5
      library/tinymce/jscripts/tiny_mce/plugins/advhr/css/advhr.css
  97. +0
    -1
      library/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin.js
  98. +0
    -57
      library/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin_src.js
  99. +0
    -43
      library/tinymce/jscripts/tiny_mce/plugins/advhr/js/rule.js
  100. +0
    -1
      library/tinymce/jscripts/tiny_mce/plugins/advhr/langs/en_dlg.js

+ 3
- 0
.gitignore View File

@ -48,3 +48,6 @@ nbproject
/php_friendica.phpproj
/php_friendica.sln
/php_friendica.phpproj.user
#ignore things from transifex-client
venv/

+ 9
- 0
.tx/config View File

@ -0,0 +1,9 @@
[main]
host = https://www.transifex.com
[friendica.messagespo]
file_filter = view/lang/<lang>/messages.po
source_file = util/messages.po
source_lang = en
type = PO

+ 30
- 1
README.translate.md View File

@ -64,5 +64,34 @@ If you only want to translate friendica into another language you wont need any
For further information see the utils/README file.
[1]: https://www.transifex.com/projects/p/friendica/
Transifex-Client
----------------
Transifex has a client program which let you interact with the translation files in a similar way to git.
Help for the client can be found at the [Transifex Help Center] [2].
Here we will only cover basic usage.
After installation of the client, you should have a `tx` command available on your system.
To use it, first create a configuration file with your credentials.
On Linux this file should be placed into your home directory `~/.transifexrc`.
The content of the file should be something like the following:
[https://www.transifex.com]
username = user
token =
password = p@ssw0rd
hostname = https://www.transifex.com
Since Friendica version 3.5.1 we ship configuration files for the Transifex client in the core repository and the addon repository.
To update the translation files after you have translated strings of e.g. Esperanto in the web-UI of transifex you can use `tx` to download the file.
$> tx pull -l eo
And then use the `po2php` utility described above to convert the `messages.po` file to the `strings.php` file Friendica is loading.
$> php util/po2php.php view/lang/eo/messages.po
Afterwards, just commit the two changed files to a feature branch of your Friendica repository, push the changes to github and open a pull request for your changes.
[1]: https://www.transifex.com/projects/p/friendica/
[2]: https://docs.transifex.com/client/introduction

+ 31
- 28
boot.php View File

@ -19,6 +19,8 @@
require_once('include/autoloader.php');
use \Friendica\Core\Config;
require_once('include/config.php');
require_once('include/network.php');
require_once('include/plugin.php');
@ -38,7 +40,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1212 );
define ( 'DB_UPDATE_VERSION', 1213 );
/**
* @brief Constant with a HTML line break.
@ -530,7 +532,6 @@ class App {
public $videoheight = 350;
public $force_max_items = 0;
public $theme_thread_allow = true;
public $theme_richtext_editor = true;
public $theme_events_in_profile = true;
/**
@ -823,24 +824,22 @@ class App {
$scheme = $this->scheme;
if ((x($this->config, 'system')) && (x($this->config['system'], 'ssl_policy'))) {
if (intval($this->config['system']['ssl_policy']) === SSL_POLICY_FULL) {
$scheme = 'https';
}
if (Config::get('system', 'ssl_policy') === SSL_POLICY_FULL) {
$scheme = 'https';
}
// Basically, we have $ssl = true on any links which can only be seen by a logged in user
// (and also the login link). Anything seen by an outsider will have it turned off.
// Basically, we have $ssl = true on any links which can only be seen by a logged in user
// (and also the login link). Anything seen by an outsider will have it turned off.
if ($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
if ($ssl) {
$scheme = 'https';
} else {
$scheme = 'http';
}
if (Config::get('system', 'ssl_policy') == SSL_POLICY_SELFSIGN) {
if ($ssl) {
$scheme = 'https';
} else {
$scheme = 'http';
}
}
if (get_config('config', 'hostname') != '') {
if (Config::get('config', 'hostname') != '') {
$this->hostname = get_config('config', 'hostname');
}
@ -1390,11 +1389,15 @@ class App {
// If the last worker fork was less than 10 seconds before then don't fork another one.
// This should prevent the forking of masses of workers.
if (get_config("system", "worker")) {
if ((time() - get_config("system", "proc_run_started")) < 10)
return;
$cachekey = "app:proc_run:started";
$result = Cache::get($cachekey);
if (!is_null($result)) {
if ((time() - $result) < 10) {
return;
}
}
// Set the timestamp of the last proc_run
set_config("system", "proc_run_started", time());
Cache::set($cachekey, time(), CACHE_MINUTE);
}
$args[0] = ((x($this->config,'php_path')) && (strlen($this->config['php_path'])) ? $this->config['php_path'] : 'php');
@ -1474,9 +1477,7 @@ function system_unavailable() {
function clean_urls() {
$a = get_app();
// if($a->config['system']['clean_urls'])
return true;
// return false;
}
function z_path() {
@ -1570,7 +1571,7 @@ function update_db(App $a) {
$stored = intval($build);
$current = intval(DB_UPDATE_VERSION);
if($stored < $current) {
load_config('database');
Config::load('database');
// We're reporting a different version than what is currently installed.
// Run any existing update scripts to bring the database up to current.
@ -2040,16 +2041,18 @@ function current_theme(){
// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
$is_mobile = $a->is_mobile || $a->is_tablet;
$standard_system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
$standard_system_theme = Config::get('system', 'theme', '');
$standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme);
if($is_mobile) {
if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
if ($is_mobile) {
if (isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
$system_theme = $standard_system_theme;
$theme_name = $standard_theme_name;
}
else {
$system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : $standard_system_theme);
} else {
$system_theme = Config::get('system', 'mobile-theme', '');
if ($system_theme == '') {
$system_theme = $standard_system_theme;
}
$theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
if($theme_name === '---') {


+ 47
- 56
database.sql View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 3.5.1-dev (Asparagus)
-- DB_UPDATE_VERSION 1212
-- DB_UPDATE_VERSION 1213
-- ------------------------------------------
@ -9,13 +9,14 @@
--
CREATE TABLE IF NOT EXISTS `addon` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL DEFAULT '',
`name` varchar(190) NOT NULL DEFAULT '',
`version` varchar(255) NOT NULL DEFAULT '',
`installed` tinyint(1) NOT NULL DEFAULT 0,
`hidden` tinyint(1) NOT NULL DEFAULT 0,
`timestamp` bigint(20) NOT NULL DEFAULT 0,
`plugin_admin` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
PRIMARY KEY(`id`),
UNIQUE INDEX `name` (`name`)
) DEFAULT CHARSET=utf8mb4;
--
@ -55,11 +56,10 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
--
CREATE TABLE IF NOT EXISTS `cache` (
`k` varbinary(255) NOT NULL,
`v` text,
`v` mediumtext,
`expire_mode` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`k`),
INDEX `updated` (`updated`),
INDEX `expire_mode_updated` (`expire_mode`,`updated`)
) DEFAULT CHARSET=utf8mb4;
@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS `config` (
`id` int(10) unsigned NOT NULL auto_increment,
`cat` varbinary(255) NOT NULL DEFAULT '',
`k` varbinary(255) NOT NULL DEFAULT '',
`v` text,
`v` mediumtext,
PRIMARY KEY(`id`),
UNIQUE INDEX `cat_k` (`cat`,`k`)
) DEFAULT CHARSET=utf8mb4;
@ -172,18 +172,20 @@ CREATE TABLE IF NOT EXISTS `contact` (
`bd` date NOT NULL DEFAULT '0000-00-00',
`notify_new_posts` tinyint(1) NOT NULL DEFAULT 0,
`fetch_further_information` tinyint(1) NOT NULL DEFAULT 0,
`ffi_keyword_blacklist` mediumtext,
`ffi_keyword_blacklist` text,
PRIMARY KEY(`id`),
INDEX `uid_name` (`uid`,`name`),
INDEX `uid_self` (`uid`,`self`),
INDEX `self_uid` (`self`,`uid`),
INDEX `alias_uid` (`alias`(32),`uid`),
INDEX `uid_pending` (`uid`,`pending`),
INDEX `uid_blocked` (`uid`,`blocked`),
INDEX `pending_uid` (`pending`,`uid`),
INDEX `blocked_uid` (`blocked`,`uid`),
INDEX `uid_rel_network_poll` (`uid`,`rel`,`network`,`poll`(64),`archive`),
INDEX `uid_network_batch` (`uid`,`network`,`batch`(64)),
INDEX `addr_uid` (`addr`(32),`uid`),
INDEX `nurl_uid` (`nurl`(32),`uid`),
INDEX `nick_uid` (`nick`(32),`uid`)
INDEX `nick_uid` (`nick`(32),`uid`),
INDEX `dfrn-id` (`dfrn-id`),
INDEX `issued-id` (`issued-id`)
) DEFAULT CHARSET=utf8mb4;
--
@ -192,12 +194,12 @@ CREATE TABLE IF NOT EXISTS `contact` (
CREATE TABLE IF NOT EXISTS `conv` (
`id` int(10) unsigned NOT NULL auto_increment,
`guid` varchar(64) NOT NULL DEFAULT '',
`recips` mediumtext,
`recips` text,
`uid` int(11) NOT NULL DEFAULT 0,
`creator` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`subject` mediumtext,
`subject` text,
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8mb4;
@ -264,7 +266,8 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`pubkey` text,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`),
INDEX `addr` (`addr`(32))
INDEX `addr` (`addr`(32)),
INDEX `url` (`url`)
) DEFAULT CHARSET=utf8mb4;
--
@ -349,10 +352,11 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`generation` tinyint(3) NOT NULL DEFAULT 0,
`server_url` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY(`id`),
INDEX `nurl` (`nurl`(32)),
INDEX `name` (`name`(32)),
INDEX `nurl` (`nurl`(64)),
INDEX `name` (`name`(64)),
INDEX `nick` (`nick`(32)),
INDEX `addr` (`addr`(32)),
INDEX `addr` (`addr`(64)),
INDEX `hide_network_updated` (`hide`,`network`,`updated`),
INDEX `updated` (`updated`)
) DEFAULT CHARSET=utf8mb4;
@ -368,8 +372,7 @@ CREATE TABLE IF NOT EXISTS `glink` (
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`),
UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
INDEX `gcid` (`gcid`),
INDEX `zcid` (`zcid`)
INDEX `gcid` (`gcid`)
) DEFAULT CHARSET=utf8mb4;
--
@ -394,8 +397,8 @@ CREATE TABLE IF NOT EXISTS `group_member` (
`gid` int(10) unsigned NOT NULL DEFAULT 0,
`contact-id` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `cid_contactid` (`cid`,`contact-id`),
INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `contactid` (`contact-id`),
INDEX `gid_contactid` (`gid`,`contact-id`),
UNIQUE INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`)
) DEFAULT CHARSET=utf8mb4;
@ -432,7 +435,7 @@ CREATE TABLE IF NOT EXISTS `hook` (
`function` varchar(255) NOT NULL DEFAULT '',
`priority` int(11) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `hook_file_function` (`hook`(30),`file`(60),`function`(30))
UNIQUE INDEX `hook_file_function` (`hook`(50),`file`(80),`function`(60))
) DEFAULT CHARSET=utf8mb4;
--
@ -532,18 +535,13 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_created` (`uid`,`created`),
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
INDEX `uid_network_received` (`uid`,`network`,`received`),
INDEX `uid_received` (`uid`,`received`),
INDEX `uid_network_commented` (`uid`,`network`,`commented`),
INDEX `uid_title` (`uid`,`title`),
INDEX `uid_thrparent` (`uid`,`thr-parent`),
INDEX `uid_parenturi` (`uid`,`parent-uri`),
INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
INDEX `authorid_created` (`author-id`,`created`),
INDEX `uid_uri` (`uid`,`uri`),
INDEX `uid_wall_created` (`uid`,`wall`,`created`),
INDEX `resource-id` (`resource-id`),
INDEX `uid_type` (`uid`,`type`),
INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
INDEX `uid_type_changed` (`uid`,`type`,`changed`),
INDEX `contactid_verb` (`contact-id`,`verb`),
@ -603,7 +601,6 @@ CREATE TABLE IF NOT EXISTS `mail` (
`parent-uri` varchar(255) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`),
INDEX `uid` (`uid`),
INDEX `uid_seen` (`uid`,`seen`),
INDEX `convid` (`convid`),
INDEX `uri` (`uri`(64)),
@ -638,7 +635,7 @@ CREATE TABLE IF NOT EXISTS `manage` (
`uid` int(11) NOT NULL DEFAULT 0,
`mid` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `uid_mid` (`uid`,`mid`)
UNIQUE INDEX `uid_mid` (`uid`,`mid`)
) DEFAULT CHARSET=utf8mb4;
--
@ -663,11 +660,10 @@ CREATE TABLE IF NOT EXISTS `notify` (
`name_cache` tinytext,
`msg_cache` mediumtext,
PRIMARY KEY(`id`),
INDEX `uid_hash` (`uid`,`hash`),
INDEX `uid_seen_date` (`uid`,`seen`,`date`),
INDEX `uid_type_link` (`uid`,`type`,`link`),
INDEX `uid_link` (`uid`,`link`),
INDEX `uid_date` (`uid`,`date`)
INDEX `hash_uid` (`hash`,`uid`),
INDEX `seen_uid_date` (`seen`,`uid`,`date`),
INDEX `uid_date` (`uid`,`date`),
INDEX `uid_type_link` (`uid`,`type`,`link`)
) DEFAULT CHARSET=utf8mb4;
--
@ -679,8 +675,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
`master-parent-item` int(10) unsigned NOT NULL DEFAULT 0,
`parent-item` int(10) unsigned NOT NULL DEFAULT 0,
`receiver-uid` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
INDEX `master-parent-item` (`master-parent-item`)
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;
--
@ -688,7 +683,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
--
CREATE TABLE IF NOT EXISTS `oembed` (
`url` varbinary(255) NOT NULL,
`content` text,
`content` mediumtext,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`),
INDEX `created` (`created`)
@ -701,7 +696,7 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
`url` varbinary(255) NOT NULL,
`guessing` tinyint(1) NOT NULL DEFAULT 0,
`oembed` tinyint(1) NOT NULL DEFAULT 0,
`content` text,
`content` mediumtext,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`,`guessing`,`oembed`),
INDEX `created` (`created`)
@ -749,7 +744,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
PRIMARY KEY(`id`),
INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_profile` (`uid`,`profile`),
INDEX `uid_album_created` (`uid`,`album`(32),`created`),
INDEX `uid_album_scale_created` (`uid`,`album`(32),`scale`,`created`),
INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`(64),`created`),
INDEX `resource-id` (`resource-id`(64))
) DEFAULT CHARSET=utf8mb4;
@ -760,16 +755,16 @@ CREATE TABLE IF NOT EXISTS `photo` (
CREATE TABLE IF NOT EXISTS `poll` (
`id` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL DEFAULT 0,
`q0` mediumtext,
`q1` mediumtext,
`q2` mediumtext,
`q3` mediumtext,
`q4` mediumtext,
`q5` mediumtext,
`q6` mediumtext,
`q7` mediumtext,
`q8` mediumtext,
`q9` mediumtext,
`q0` text,
`q1` text,
`q2` text,
`q3` text,
`q4` text,
`q5` text,
`q6` text,
`q7` text,
`q8` text,
`q9` text,
PRIMARY KEY(`id`),
INDEX `uid` (`uid`)
) DEFAULT CHARSET=utf8mb4;
@ -843,7 +838,8 @@ CREATE TABLE IF NOT EXISTS `profile` (
`thumb` varchar(255) NOT NULL DEFAULT '',
`publish` tinyint(1) NOT NULL DEFAULT 0,
`net-publish` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`)
PRIMARY KEY(`id`),
INDEX `uid_is-default` (`uid`,`is-default`)
) DEFAULT CHARSET=utf8mb4;
--
@ -979,8 +975,6 @@ CREATE TABLE IF NOT EXISTS `term` (
`uid` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`tid`),
INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`),
INDEX `uid_term_tid` (`uid`,`term`(32),`tid`),
INDEX `type_term` (`type`,`term`(32)),
INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
INDEX `guid` (`guid`(64))
@ -1017,8 +1011,6 @@ CREATE TABLE IF NOT EXISTS `thread` (
`mention` tinyint(1) NOT NULL DEFAULT 0,
`network` varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY(`iid`),
INDEX `created` (`created`),
INDEX `commented` (`commented`),
INDEX `uid_network_commented` (`uid`,`network`,`commented`),
INDEX `uid_network_created` (`uid`,`network`,`created`),
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
@ -1111,7 +1103,6 @@ CREATE TABLE IF NOT EXISTS `workerqueue` (
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`pid` int(11) NOT NULL DEFAULT 0,
`executed` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`),
INDEX `created` (`created`)
PRIMARY KEY(`id`)
) DEFAULT CHARSET=utf8mb4;

+ 13
- 13
doc/FAQ.md View File

@ -43,29 +43,29 @@ We recommend to talk to the admin(s) of the affected friendica server. (Admins,
###How can I upload images, files, links, videos and sound files to posts?
You can upload images from your computer by using the [editor](help/Text_editor).
You can upload images from your computer using the [editor](help/Text_editor).
An overview of all uploaded images is listed at *yourpage.com/photos/profilename*.
On that page, you can also upload images directly and choose, if your contacts shall receive a message about this upload.
On that page, you can also upload images directly and choose if your contacts will receive a message about this upload.
Generally, you could attach every kind of file to a post.
Generally, you can attach any kind of file to a post.
This is possible by using the "paper-clip"-symbol in the editor.
These files will be linked to your post and can be downloaded by your contacts.
But it's not possible to get a preview for these ones.
Because of this, this upload method is recommended for office or zipped files.
If you want share content from Dropbox, Owncloud or any other [filehoster](http://en.wikipedia.org/wiki/Comparison_of_file_hosting_services), use the "link"-button (chain-symbol).
But it's not possible to get a preview for these items.
Because of this, this upload method is only recommended for office or zipped files.
If you want to share content from Dropbox, Owncloud or any other [filehoster](http://en.wikipedia.org/wiki/Comparison_of_file_hosting_services), use the "link"-button (chain-symbol).
When you're adding URLs of other webpages with the "link"-button, Friendica tries to create a small preview.
If this doesn't work, try to add the link by typing: [url=http://example.com]*self-chosen name*[/url].
You can also add video and audio files to posts.
But instead of a direct upload you have to use one of the following methods:
However, instead of a direct upload you have to use one of the following methods:
1. Add the video or audio link of a hoster (Youtube, Vimeo, Soundcloud and everyone else with oembed/opengraph-support). Videos will be shown with a preview image you can click on to start it. SoundCloud directly inserts a player to your post.
1. Add the video or audio link of a hoster (Youtube, Vimeo, Soundcloud and anyone else with oembed/opengraph-support). Videos will be shown with a preview image you can click on to start. SoundCloud directly inserts a player to your post.
2. If you have your own server, you can upload multimedia files via FTP and insert the URL.
Friendica is using HTML5 for embedding content.
Therefore, the supported files are depending on your browser and operating system.
Friendica uses HTML5 for embedding content.
Therefore, the supported files are dependent on your browser and operating system.
Some supported filetypes are WebM, MP4, MP3 and OGG.
See Wikipedia for more of them ([video](http://en.wikipedia.org/wiki/HTML5_video), [audio](http://en.wikipedia.org/wiki/HTML5_audio)).
@ -188,7 +188,7 @@ Admin
###Can I configure multiple domains with the same code instance?
No, this function is not supported anymore starting from Friendica 3.3.
No, this function is no longer supported from Friendica 3.3 onwards.
<a name="sources"></a>
@ -202,12 +202,12 @@ Addons are listed at [this page](https://github.com/friendica/friendica-addons).
If you are searching for new themes, you can find them at [Friendica-Themes.com](http://friendica-themes.com/)
<a name="adminaccount1"></a>
###I've changed the 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.
<a name="adminaccount2"></a>
###Can there be more then just one admin for a node?
###Can there be more then one admin for a node?
Yes. You just have to list more then one email address in the
<tt>.htconfig.php</tt> file. The listed emails need to be separated by a comma.

+ 9
- 10
doc/Settings.md View File

@ -36,7 +36,7 @@ Therefore this document does not yet cover all the options
Set the content for the site banner.
The default logo is the Friendica logo and name.
You may wish to provide HTML/CSS to style and/or position this content, as it may not be themed by default.
You may wish to provide HTML/CSS to style and/or position this content, as it may not be themed by default.
#### Language
@ -65,7 +65,7 @@ You may find a lot of spammers trying to register on your site.
During testing we discovered that since these registrations were automatic, the "Full Name" field was often set to just an account name with no space between first and last name.
If you would like to support people with only one name as their full name, you may change this setting to true.
Default is false.
#### OpenID
By default, OpenID may be used for both registration and logins.
@ -80,7 +80,7 @@ By default, logged in users can register additional accounts for use as pages.
These will still require approval if the registration policy is set to *require approval*
You may prohibit logged in users from creating additional accounts by setting *block multible registrations* to true.
Default is false.
### File upload
#### Maximum Image Size
@ -94,7 +94,7 @@ The default is set to 0, which means no limits.
This configures the URL to update the global directory, and is supplied in the default configuration.
The undocumented part is that if this is not set, the global directory is completely unavailable to the application.
This allows a private community to be completely isolated from the global network.
This allows a private community to be completely isolated from the global network.
#### Force Publish
@ -130,7 +130,7 @@ Wildcards are accepted.
(Wildcard support on Windows platforms requires PHP5.3).
By default, any (valid) email address is allowed in registrations.
#### Allow Users to set remote_self
#### Allow Users to set remote_self
If you enable the `Allow Users to set remote_self` users can select Atom feeds from their contact list being their *remote self* in die advanced contact settings.
Which means that postings by the remote self are automatically reposted by Friendica in their names.
@ -165,7 +165,7 @@ By default Friendica allows SSL communication between websites that have "self-s
For the widest compatibility with browsers and other networks we do not recommend using self-signed certificates, but we will not prevent you from using them.
SSL encrypts all the data transmitted between sites (and to your browser).
This allows you to have completely encrypted communications, and also protect your login session from hijacking.
Self-signed certificates can be generated for free, without paying top-dollar for a website SSL certificate.
Self-signed certificates can be generated for free, without paying top-dollar for a website SSL certificate.
However these aren't looked upon favourably in the security community because they can be subject to so-called "man-in-the-middle" attacks.
If you wish, you can turn on strict certificate checking.
This will mean you cannot connect (at all) to self-signed SSL sites.
@ -213,8 +213,7 @@ To select a default theme for the Friendica node, see the *Site* section of the
## Additional Features
There are several optional features in Friendica.
Like the *dislike* button or the usage of a *richtext editor* for composing new postings.
There are several optional features in Friendica like the *dislike* button.
In this section of the admin panel you can select a default setting for your node and eventually fix it, so users cannot change the setting anymore.
## DB Updates
@ -270,7 +269,7 @@ You should set up some kind of [log rotation](https://en.wikipedia.org/wiki/Log_
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.
Use the following settings to redirect PHP errors to a file.
Use the following settings to redirect PHP errors to a file.
Config:
@ -283,7 +282,7 @@ This will put all PHP errors in the file php.out (which must be writeable by the
Undeclared variables are occasionally referenced in the program and therefore we do not recommend using `E_NOTICE` or `E_ALL`.
The vast majority of issues reported at these levels are completely harmless.
Please report to the developers any errors you encounter in the logs using the recommended settings above.
They generally indicate issues which need to be resolved.
They generally indicate issues which need to be resolved.
If you encounter a blank (white) page when using the application, view the PHP logs - as this almost always indicates an error has occurred.


+ 6
- 21
doc/Text_editor.md View File

@ -1,7 +1,7 @@
<style>
<style>
figure { border: 4px #eeeeee solid; }
figure img { padding: 2px; }
figure figcaption { background: #eeeeee; color: #444444; padding: 2px; font-style: italic;}
figure figcaption { background: #eeeeee; color: #444444; padding: 2px; font-style: italic;}
</style>
Creating posts
@ -9,7 +9,7 @@ Creating posts
* [Home](help)
Here you can find an overview of the different ways to create and edit your post.
Here you can find an overview of the different ways to create and edit your post.
One click on "Share" text box on top of your Home or Network page, and the post editor shows up:
@ -42,7 +42,7 @@ The icons under the text area are there to help you to write posts quickly:
<img src="doc/img/video.png" width="32" height="32" alt="video" align="left"> Add a video. Enter the url to a video (ogg) or to a video page on youtube or vimeo, and it will be embedded in your post with a preview. Friendica is using [HTML5](http://en.wikipedia.org/wiki/HTML5_video) for embedding content. Therefore, the supported files are depending on your browser and operating system (OS). Some filetypes are WebM, MP4 and OGG.*
<p style="clear:both;"></p>
<img src="doc/img/mic.png" width="32" height="32" alt="mic" align="left" style="padding-bottom: 20px;"> Add an audio. Same as video, but for audio. Depending on your browser and operation system MP3, OGG and AAC are supported. Additionally, you are able to add URLs from audiohosters like Soundcloud.
<img src="doc/img/mic.png" width="32" height="32" alt="mic" align="left" style="padding-bottom: 20px;"> Add an audio. Same as video, but for audio. Depending on your browser and operation system MP3, OGG and AAC are supported. Additionally, you are able to add URLs from audiohosters like Soundcloud.
<p style="clear:both;"></p>
@ -88,26 +88,11 @@ Click on "show" under contact name to hide the post to everyone but selected.
Click on "Visible to everybody" to make the post public again.
If you have defined some groups, you can check "show" for groups also. All contact in that group will see the post.
If you have defined some groups, you can check "show" for groups also. All contact in that group will see the post.
If you want to hide the post to one contact of a group selected for "show", click "don't show" under contact name.
Click again on "show" or "don't show" to switch it off.
You can search for contacts or groups with the search box.
See also [Group and Privacy](help/Groups-and-Privacy)
WYSIAWYG (What You See Is About What You Get)
--------------------------------------------------
Friendica can use TinyMCE as rich text editor. This way you can write beatifull post without the need to know [BBCode](help/BBCode).
By default, rich editor is disabled. You can enable it from Settings -> [Aditional features](settings/features) page, turn on Richtext Editor and click "Submit".
<figure>
<img src="doc/img/friendica_rich_editor.png" alt="default editor">
<figcaption>Rich editor, with default Friendica theme (duepuntozero)</figcaption>
</figure>
See also [Group and Privacy](help/Groups-and-Privacy)

+ 8
- 0
doc/htconfig.md View File

@ -25,6 +25,14 @@ Example: To set the directory value please add this line to your .htconfig.php:
* **allowed_link_protocols** (Array) - Allowed protocols in links URLs, add at your own risk. http is always allowed.
* **birthday_input_format** - Default value is "ymd".
* **block_local_dir** (Boolean) - Blocks the access to the directory of the local users.
* **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** (Boolean) - Enable the automatic database cleanup process
* **default_service_class** -
* **delivery_batch_count** - Number of deliveries per process. Default value is 1. (Disabled when using the worker)


+ 30
- 0
doc/translations.md View File

@ -66,5 +66,35 @@ If you only want to translate friendica into another language you wont need any
For further information see the utils/README file.
Transifex-Client
----------------
Transifex has a client program which let you interact with the translation files in a similar way to git.
Help for the client can be found at the [Transifex Help Center] [2].
Here we will only cover basic usage.
After installation of the client, you should have a `tx` command available on your system.
To use it, first create a configuration file with your credentials.
On Linux this file should be placed into your home directory `~/.transifexrc`.
The content of the file should be something like the following:
[https://www.transifex.com]
username = user
token =
password = p@ssw0rd
hostname = https://www.transifex.com
Since Friendica version 3.5.1 we ship configuration files for the Transifex client in the core repository and the addon repository.
To update the translation files after you have translated strings of e.g. Esperanto in the web-UI of transifex you can use `tx` to download the file.
$> tx pull -l eo
And then use the `po2php` utility described above to convert the `messages.po` file to the `strings.php` file Friendica is loading.
$> php util/po2php.php view/lang/eo/messages.po
Afterwards, just commit the two changed files to a feature branch of your Friendica repository, push the changes to github and open a pull request for your changes.
[1]: https://www.transifex.com/projects/p/friendica/
[2]: https://docs.transifex.com/client/introduction

+ 48
- 28
include/Core/Config.php View File

@ -22,6 +22,8 @@ use dbm;
*/
class Config {
private static $cache;
/**
* @brief Loads all configuration values of family into a cached storage.
*
@ -32,10 +34,17 @@ class Config {
* The category of the configuration value
* @return void
*/
public static function load($family) {
public static function load($family = "config") {
// We don't preload "system" anymore.
// This reduces the number of database reads a lot.
if ($family === 'system') {
return;
}
$a = get_app();
$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
$r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family));
if (dbm::is_result($r)) {
foreach ($r as $rr) {
$k = $rr['k'];
@ -43,11 +52,9 @@ class Config {
$a->config[$k] = $rr['v'];
} else {
$a->config[$family][$k] = $rr['v'];
self::$cache[$family][$k] = $rr['v'];
}
}
} else if ($family != 'config') {
// Negative caching
$a->config[$family] = "!<unset>!";
}
}
@ -78,34 +85,38 @@ class Config {
$a = get_app();
if (!$refresh) {
// Looking if the whole family isn't set
if (isset($a->config[$family])) {
if ($a->config[$family] === '!<unset>!') {
return $default_value;
}
}
if (isset($a->config[$family][$key])) {
if ($a->config[$family][$key] === '!<unset>!') {
// Do we have the cached value? Then return it
if (isset(self::$cache[$family][$key])) {
if (self::$cache[$family][$key] === '!<unset>!') {
return $default_value;
} else {
return self::$cache[$family][$key];
}
return $a->config[$family][$key];
}
}
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s'",
dbesc($family),
dbesc($key)
);
if (count($ret)) {
if (dbm::is_result($ret)) {
// manage array value
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v'])?unserialize( $ret[0]['v']):$ret[0]['v']);
$a->config[$family][$key] = $val;
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret[0]['v']) ? unserialize($ret[0]['v']) : $ret[0]['v']);
// Assign the value from the database to the cache
self::$cache[$family][$key] = $val;
return $val;
} else {
$a->config[$family][$key] = '!<unset>!';
} elseif (isset($a->config[$family][$key])) {
// Assign the value (mostly) from the .htconfig.php to the cache
self::$cache[$family][$key] = $a->config[$family][$key];
return $a->config[$family][$key];
}
self::$cache[$family][$key] = '!<unset>!';
return $default_value;
}
@ -128,17 +139,28 @@ class Config {
public static function set($family, $key, $value) {
$a = get_app();
// We store our setting values in a string variable.
// So we have to do the conversion here so that the compare below works.
// The exception are array values.
$dbvalue = (!is_array($value) ? (string)$value : $value);
$stored = self::get($family, $key);
if ($stored == $value) {
if ($stored === $dbvalue) {
return true;
}
$a->config[$family][$key] = $value;
if ($family === 'config') {
$a->config[$key] = $dbvalue;
} elseif ($family != 'system') {
$a->config[$family][$key] = $dbvalue;
}
// Assign the just added value to the cache
self::$cache[$family][$key] = $dbvalue;
// manage array value
$dbvalue = (is_array($value) ? serialize($value) : $value);
$dbvalue = (is_bool($dbvalue) ? intval($dbvalue) : $dbvalue);
$dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
if (is_null($stored)) {
$ret = q("INSERT INTO `config` (`cat`, `k`, `v`) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE `v` = '%s'",
@ -174,9 +196,8 @@ class Config {
*/
public static function delete($family, $key) {
$a = get_app();
if (x($a->config[$family],$key)) {
unset($a->config[$family][$key]);
if (isset(self::$cache[$family][$key])) {
unset(self::$cache[$family][$key]);
}
$ret = q("DELETE FROM `config` WHERE `cat` = '%s' AND `k` = '%s'",
dbesc($family),
@ -185,5 +206,4 @@ class Config {
return $ret;
}
}

+ 10
- 2
include/Probe.php View File

@ -715,11 +715,19 @@ class Probe {
$photos = $xpath->query("//*[contains(concat(' ', @class, ' '), ' photo ') or contains(concat(' ', @class, ' '), ' avatar ')]", $vcard); // */
foreach ($photos AS $photo) {
$attr = array();
foreach ($photo->attributes as $attribute)
foreach ($photo->attributes as $attribute) {
$attr[$attribute->name] = trim($attribute->value);
}
if (isset($attr["src"]) AND isset($attr["width"]))
if (isset($attr["src"]) AND isset($attr["width"])) {
$avatar[$attr["width"]] = $attr["src"];
}
// We don't have a width. So we just take everything that we got.
// This is a Hubzilla workaround which doesn't send a width.
if ((sizeof($avatar) == 0) AND isset($attr["src"])) {
$avatar[] = $attr["src"];
}
}
if (sizeof($avatar)) {


+ 2
- 0
include/acl_selectors.php View File

@ -495,6 +495,8 @@ function acl_lookup(App $a, $out_type = 'json') {
if ($type=='' || $type=='g'){
/// @todo We should cache this query.
// This can be done when we can delete cache entries via wildcard
$r = q("SELECT `group`.`id`, `group`.`name`, GROUP_CONCAT(DISTINCT `group_member`.`contact-id` SEPARATOR ',') AS uids
FROM `group`
INNER JOIN `group_member` ON `group_member`.`gid`=`group`.`id` AND `group_member`.`uid` = `group`.`uid`


+ 11
- 5
include/api.php View File

@ -5,6 +5,9 @@
*
* @todo Automatically detect if incoming data is HTML or BBCode
*/
use \Friendica\Core\Config;
require_once('include/HTTPExceptions.php');
require_once('include/bbcode.php');
@ -2344,6 +2347,9 @@
* dislikes => int count
*/
function api_format_items_activities(&$item, $type = "json") {
$a = get_app();
$activities = array(
'like' => array(),
'dislike' => array(),
@ -2521,9 +2527,9 @@
// Retweets are only valid for top postings
// It doesn't work reliable with the link if its a feed
#$IsRetweet = ($item['owner-link'] != $item['author-link']);
#if ($IsRetweet)
# $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
//$IsRetweet = ($item['owner-link'] != $item['author-link']);
//if ($IsRetweet)
// $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
if ($item["id"] == $item["parent"]) {
@ -2693,11 +2699,11 @@
$logo = App::get_baseurl() . '/images/friendica-64.png';
$email = $a->config['admin_email'];
$closed = (($a->config['register_policy'] == REGISTER_CLOSED) ? 'true' : 'false');
$private = (($a->config['system']['block_public']) ? 'true' : 'false');
$private = ((Config::get('system', 'block_public')) ? 'true' : 'false');
$textlimit = (string) (($a->config['max_import_size']) ? $a->config['max_import_size'] : 200000);
if($a->config['api_import_size'])
$texlimit = string($a->config['api_import_size']);
$ssl = (($a->config['system']['have_ssl']) ? 'true' : 'false');
$ssl = ((Config::get('system', 'have_ssl')) ? 'true' : 'false');
$sslserver = (($ssl === 'true') ? str_replace('http:','https:',App::get_baseurl()) : '');
$config = array(


+ 1
- 1
include/cache.php View File

@ -186,7 +186,7 @@ class Cache {
set_config("system", "cache_cleared_half_hour", time());
}
if (($max_level <= CACHE_QUARTER_HOUR) AND (get_config("system", "cache_cleared_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
if (($max_level <= CACHE_QUARTER_HOUR) AND (get_config("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 15 minutes")), intval(CACHE_QUARTER_HOUR));


+ 9
- 8
include/cli_startup.php View File

@ -1,5 +1,7 @@
<?php /** @file */
use \Friendica\Core\Config;
require_once('boot.php');
// Everything we need to boot standalone 'background' processes
@ -8,21 +10,20 @@ function cli_startup() {
global $a, $db;
if(is_null($a)) {
if (is_null($a)) {
$a = new App;
}
if(is_null($db)) {
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
if (is_null($db)) {
@include(".htconfig.php");
require_once("dba.php");
$db = new dba($db_host, $db_user, $db_pass, $db_data);
unset($db_host, $db_user, $db_pass, $db_data);
};
require_once('include/session.php');
load_config('config');
load_config('system');
Config::load();
$a->set_baseurl(get_config('system','url'));


+ 1
- 1
include/contact_widgets.php View File

@ -90,7 +90,7 @@ function networks_widget($baseurl,$selected = '') {
$extra_sql = unavailable_networks();
$r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND NOT `self` $extra_sql ORDER BY `network`",
$r = q("SELECT DISTINCT(`network`) FROM `contact` WHERE `uid` = %d AND `network` != '' $extra_sql ORDER BY `network`",
intval(local_user())
);


+ 0
- 11
include/conversation.php View File

@ -1170,23 +1170,14 @@ function format_like($cnt,$arr,$type,$id) {
function status_editor($a,$x, $notes_cid = 0, $popup=false) {
$o = '';
$geotag = (($x['allow_location']) ? replace_macros(get_markup_template('jot_geotag.tpl'), array()) : '');
/* $plaintext = false;
if( local_user() && (intval(get_pconfig(local_user(),'system','plaintext')) || !feature_enabled(local_user(),'richtext')) )
$plaintext = true;*/
$plaintext = true;
if( local_user() && feature_enabled(local_user(),'richtext') )
$plaintext = false;
$tpl = get_markup_template('jot-header.tpl');
$a->page['htmlhead'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),
@ -1199,12 +1190,10 @@ function status_editor($a,$x, $notes_cid = 0, $popup=false) {
'$delitems' => t('Delete item(s)?')
));
$tpl = get_markup_template('jot-end.tpl');
$a->page['end'] .= replace_macros($tpl, array(
'$newpost' => 'true',
'$baseurl' => App::get_baseurl(true),
'$editselect' => (($plaintext) ? 'none' : '/(profile-jot-text|prvmail-text)/'),
'$geotag' => $geotag,
'$nickname' => $x['nickname'],
'$ispublic' => t('Visible to <strong>everybody</strong>'),


+ 4
- 2
include/create_shadowentry.php View File

@ -5,6 +5,9 @@
*
* This script is started from mod/item.php to save some time when doing a post.
*/
use \Friendica\Core\Config;
require_once("boot.php");
require_once("include/threads.php");
@ -21,8 +24,7 @@ function create_shadowentry_run($argv, $argc) {
unset($db_host, $db_user, $db_pass, $db_data);
}
load_config('config');
load_config('system');
Config::load();
if ($argc != 2) {
return;


+ 12
- 8
include/cron.php View File

@ -10,6 +10,8 @@ if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
chdir($directory);
}
use \Friendica\Core\Config;
require_once("boot.php");
require_once("include/photos.php");
require_once("include/user.php");
@ -38,8 +40,7 @@ function cron_run(&$argv, &$argc){
require_once('mod/nodeinfo.php');
require_once('include/post_update.php');
load_config('config');
load_config('system');
Config::load();
// Don't check this stuff if the function is called by the poller
if (App::callstack() != "poller_run") {
@ -239,11 +240,13 @@ function cron_poll_contacts($argc, $argv) {
: ''
);
$contacts = q("SELECT `contact`.`id` FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
WHERE `rel` IN (%d, %d) AND `poll` != '' AND `network` IN ('%s', '%s', '%s', '%s', '%s', '%s')
$sql_extra
AND NOT `self` AND NOT `contact`.`blocked` AND NOT `contact`.`readonly` AND NOT `contact`.`archive`
AND NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql ORDER BY RAND()",
$contacts = q("SELECT `contact`.`id` FROM `user`
STRAIGHT_JOIN `contact`
ON `contact`.`uid` = `user`.`uid` AND `contact`.`rel` IN (%d, %d) AND `contact`.`poll` != ''
AND `contact`.`network` IN ('%s', '%s', '%s', '%s', '%s', '%s') $sql_extra
AND NOT `contact`.`self` AND NOT `contact`.`blocked` AND NOT `contact`.`readonly`
AND NOT `contact`.`archive`
WHERE NOT `user`.`account_expired` AND NOT `user`.`account_removed` $abandon_sql ORDER BY RAND()",
intval(CONTACT_IS_SHARING),
intval(CONTACT_IS_FRIEND),
dbesc(NETWORK_DFRN),
@ -264,8 +267,9 @@ function cron_poll_contacts($argc, $argv) {
intval($c['id'])
);
if (dbm::is_result($res))
if (!dbm::is_result($res)) {
continue;
}
foreach($res as $contact) {


+ 3
- 3
include/cronhooks.php View File

@ -1,7 +1,8 @@
<?php
require_once("boot.php");
use \Friendica\Core\Config;
require_once("boot.php");
function cronhooks_run(&$argv, &$argc){
global $a, $db;
@ -20,8 +21,7 @@ function cronhooks_run(&$argv, &$argc){
require_once('include/session.php');
require_once('include/datetime.php');
load_config('config');
load_config('system');
Config::load();
// Don't check this stuff if the function is called by the poller
if (App::callstack() != "poller_run") {


+ 3
- 2
include/cronjobs.php View File

@ -1,4 +1,6 @@
<?php
use \Friendica\Core\Config;
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]);
@ -33,8 +35,7 @@ function cronjobs_run(&$argv, &$argc){
require_once('include/post_update.php');
require_once('mod/nodeinfo.php');
load_config('config');
load_config('system');
Config::load();
$a->set_baseurl(get_config('system','url'));


+ 4
- 2
include/datetime.php View File

@ -4,6 +4,7 @@
* @brief Some functions for date and time related tasks.
*/
use \Friendica\Core\Config;
/**
* @brief Two-level sort for timezones.
@ -271,8 +272,9 @@ function datetimesel($format, $min, $max, $default, $label, $id = 'datetimepicke
$lang = substr(get_browser_language(), 0, 2);
// Check if the detected language is supported by the picker
if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu")))
$lang = ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en');
if (!in_array($lang, array("ar", "ro", "id", "bg", "fa", "ru", "uk", "en", "el", "de", "nl", "tr", "fr", "es", "th", "pl", "pt", "ch", "se", "kr", "it", "da", "no", "ja", "vi", "sl", "cs", "hu"))) {
$lang = Config::get('system', 'language', 'en');
}
$o = '';
$dateformat = '';


+ 62
- 0
include/dba.php View File

@ -138,6 +138,62 @@ class dba {
return $return;
}
/**
* @brief Analyze a database query and log this if some conditions are met.
*
* @param string $query The database query that will be analyzed
*/
public function log_index($query) {
$a = get_app();
if ($a->config["system"]["db_log_index"] == "") {
return;
}
// Don't explain an explain statement
if (strtolower(substr($query, 0, 7)) == "explain") {
return;
}
// Only do the explain on "select", "update" and "delete"
if (!in_array(strtolower(substr($query, 0, 6)), array("select", "update", "delete"))) {
return;
}
$r = $this->q("EXPLAIN ".$query);
if (!dbm::is_result($r)) {
return;
}
$watchlist = explode(',', $a->config["system"]["db_log_index_watch"]);
$blacklist = explode(',', $a->config["system"]["db_log_index_blacklist"]);
foreach ($r AS $row) {
if ((intval($a->config["system"]["db_loglimit_index"]) > 0)) {
$log = (in_array($row['key'], $watchlist) AND
($row['rows'] >= intval($a->config["system"]["db_loglimit_index"])));
} else
$log = false;
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) AND ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
$log = true;
}
if (in_array($row['key'], $blacklist) OR ($row['key'] == "")) {
$log = false;
}
if ($log) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($a->config["system"]["db_log_index"], datetime_convert()."\t".
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
basename($backtrace[1]["file"])."\t".
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
substr($query, 0, 2000)."\n", FILE_APPEND);
}
}
}
public function q($sql, $onlyquery = false) {
$a = get_app();
@ -375,6 +431,9 @@ function q($sql) {
//logger("dba: q: $stmt", LOGGER_ALL);
if ($stmt === false)
logger('dba: vsprintf error: ' . print_r(debug_backtrace(),true), LOGGER_DEBUG);
$db->log_index($stmt);
return $db->q($stmt);
}
@ -408,6 +467,9 @@ function qu($sql) {
$stmt = @vsprintf($sql,$args); // Disabled warnings
if ($stmt === false)
logger('dba: vsprintf error: ' . print_r(debug_backtrace(),true), LOGGER_DEBUG);
$db->log_index($stmt);