Merge remote-tracking branch 'friendica/develop' into issue/#3062

# Conflicts:
#	view/theme/duepuntozero/theme.php
#	view/theme/smoothly/theme.php
This commit is contained in:
Hypolite Petovan 2017-01-12 09:19:59 +11:00
commit b61479ba6e
166 changed files with 835 additions and 789 deletions

View File

@ -1,5 +1,5 @@
Friendica Communications Server Friendica Communications Server
Copyright (c) 2010-2016 the Friendica Project Copyright (c) 2010-2017 the Friendica Project
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by it under the terms of the GNU Affero General Public License as published by

View File

@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus'); define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5.1-dev' ); define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1211 ); define ( 'DB_UPDATE_VERSION', 1212 );
/** /**
* @brief Constant with a HTML line break. * @brief Constant with a HTML line break.
@ -1539,7 +1539,7 @@ function check_db() {
* Sets the base url for use in cmdline programs which don't have * Sets the base url for use in cmdline programs which don't have
* $_SERVER variables * $_SERVER variables
*/ */
function check_url(App &$a) { function check_url(App $a) {
$url = get_config('system','url'); $url = get_config('system','url');
@ -1561,7 +1561,7 @@ function check_url(App &$a) {
/** /**
* @brief Automatic database updates * @brief Automatic database updates
*/ */
function update_db(App &$a) { function update_db(App $a) {
$build = get_config('system','build'); $build = get_config('system','build');
if(! x($build)) if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION); $build = set_config('system','build',DB_UPDATE_VERSION);
@ -1677,7 +1677,7 @@ function run_update_function($x) {
* @param App $a * @param App $a
* *
*/ */
function check_plugins(App &$a) { function check_plugins(App $a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1"); $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
if (dbm::is_result($r)) if (dbm::is_result($r))
@ -2413,7 +2413,7 @@ function get_temppath() {
} }
/// @deprecated /// @deprecated
function set_template_engine(App &$a, $engine = 'internal') { function set_template_engine(App $a, $engine = 'internal') {
/// @note This function is no longer necessary, but keep it as a wrapper to the class method /// @note This function is no longer necessary, but keep it as a wrapper to the class method
/// to avoid breaking themes again unnecessarily /// to avoid breaking themes again unnecessarily

View File

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 3.5.1-dev (Asparagus) -- Friendica 3.5.1-dev (Asparagus)
-- DB_UPDATE_VERSION 1211 -- DB_UPDATE_VERSION 1212
-- ------------------------------------------ -- ------------------------------------------
@ -174,9 +174,16 @@ CREATE TABLE IF NOT EXISTS `contact` (
`fetch_further_information` tinyint(1) NOT NULL DEFAULT 0, `fetch_further_information` tinyint(1) NOT NULL DEFAULT 0,
`ffi_keyword_blacklist` mediumtext, `ffi_keyword_blacklist` mediumtext,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`), INDEX `uid_name` (`uid`,`name`),
INDEX `addr_uid` (`addr`,`uid`), INDEX `uid_self` (`uid`,`self`),
INDEX `nurl` (`nurl`) INDEX `alias_uid` (`alias`(32),`uid`),
INDEX `uid_pending` (`uid`,`pending`),
INDEX `uid_blocked` (`uid`,`blocked`),
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`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -232,7 +239,7 @@ CREATE TABLE IF NOT EXISTS `event` (
`deny_cid` mediumtext, `deny_cid` mediumtext,
`deny_gid` mediumtext, `deny_gid` mediumtext,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`) INDEX `uid_start` (`uid`,`start`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -257,7 +264,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
`pubkey` text, `pubkey` text,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `addr` (`addr`) INDEX `addr` (`addr`(32))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -280,7 +287,7 @@ CREATE TABLE IF NOT EXISTS `fserver` (
`posturl` varchar(255) NOT NULL DEFAULT '', `posturl` varchar(255) NOT NULL DEFAULT '',
`key` text, `key` text,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `server` (`server`) INDEX `server` (`server`(32))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -342,10 +349,10 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
`generation` tinyint(3) NOT NULL DEFAULT 0, `generation` tinyint(3) NOT NULL DEFAULT 0,
`server_url` varchar(255) NOT NULL DEFAULT '', `server_url` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `nurl` (`nurl`), INDEX `nurl` (`nurl`(32)),
INDEX `name` (`name`), INDEX `name` (`name`(32)),
INDEX `nick` (`nick`), INDEX `nick` (`nick`(32)),
INDEX `addr` (`addr`), INDEX `addr` (`addr`(32)),
INDEX `updated` (`updated`) INDEX `updated` (`updated`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -360,7 +367,7 @@ CREATE TABLE IF NOT EXISTS `glink` (
`zcid` int(11) NOT NULL DEFAULT 0, `zcid` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`), UNIQUE INDEX `cid_uid_gcid_zcid` (`cid`,`uid`,`gcid`,`zcid`),
INDEX `gcid` (`gcid`), INDEX `gcid` (`gcid`),
INDEX `zcid` (`zcid`) INDEX `zcid` (`zcid`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -387,7 +394,9 @@ CREATE TABLE IF NOT EXISTS `group_member` (
`gid` int(10) unsigned NOT NULL DEFAULT 0, `gid` int(10) unsigned NOT NULL DEFAULT 0,
`contact-id` int(10) unsigned NOT NULL DEFAULT 0, `contact-id` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`) INDEX `cid_contactid` (`cid`,`contact-id`),
INDEX `uid_contactid` (`uid`,`contact-id`),
UNIQUE INDEX `uid_gid_contactid` (`uid`,`gid`,`contact-id`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -410,7 +419,7 @@ CREATE TABLE IF NOT EXISTS `gserver` (
`last_contact` datetime DEFAULT '0000-00-00 00:00:00', `last_contact` datetime DEFAULT '0000-00-00 00:00:00',
`last_failure` datetime DEFAULT '0000-00-00 00:00:00', `last_failure` datetime DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `nurl` (`nurl`) INDEX `nurl` (`nurl`(32))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -525,24 +534,17 @@ CREATE TABLE IF NOT EXISTS `item` (
INDEX `uid_network_received` (`uid`,`network`,`received`), INDEX `uid_network_received` (`uid`,`network`,`received`),
INDEX `uid_received` (`uid`,`received`), INDEX `uid_received` (`uid`,`received`),
INDEX `uid_network_commented` (`uid`,`network`,`commented`), INDEX `uid_network_commented` (`uid`,`network`,`commented`),
INDEX `uid_commented` (`uid`,`commented`),
INDEX `uid_title` (`uid`,`title`), INDEX `uid_title` (`uid`,`title`),
INDEX `uid_thrparent` (`uid`,`thr-parent`), INDEX `uid_thrparent` (`uid`,`thr-parent`),
INDEX `uid_parenturi` (`uid`,`parent-uri`), INDEX `uid_parenturi` (`uid`,`parent-uri`),
INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`), INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`), INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
INDEX `gcontactid_uid_created` (`gcontact-id`,`uid`,`created`),
INDEX `authorid_created` (`author-id`,`created`), INDEX `authorid_created` (`author-id`,`created`),
INDEX `ownerid_created` (`owner-id`,`created`),
INDEX `wall_body` (`wall`,`body`(6)),
INDEX `uid_visible_moderated_created` (`uid`,`visible`,`moderated`,`created`),
INDEX `uid_uri` (`uid`,`uri`), INDEX `uid_uri` (`uid`,`uri`),
INDEX `uid_wall_created` (`uid`,`wall`,`created`), INDEX `uid_wall_created` (`uid`,`wall`,`created`),
INDEX `resource-id` (`resource-id`), INDEX `resource-id` (`resource-id`),
INDEX `uid_type` (`uid`,`type`), INDEX `uid_type` (`uid`,`type`),
INDEX `uid_starred_id` (`uid`,`starred`,`id`),
INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)), INDEX `contactid_allowcid_allowpid_denycid_denygid` (`contact-id`,`allow_cid`(10),`allow_gid`(10),`deny_cid`(10),`deny_gid`(10)),
INDEX `uid_wall_parent_created` (`uid`,`wall`,`parent`,`created`),
INDEX `uid_type_changed` (`uid`,`type`,`changed`), INDEX `uid_type_changed` (`uid`,`type`,`changed`),
INDEX `contactid_verb` (`contact-id`,`verb`), INDEX `contactid_verb` (`contact-id`,`verb`),
INDEX `deleted_changed` (`deleted`,`changed`), INDEX `deleted_changed` (`deleted`,`changed`),
@ -564,7 +566,7 @@ CREATE TABLE IF NOT EXISTS `item_id` (
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`), INDEX `uid` (`uid`),
INDEX `sid` (`sid`), INDEX `sid` (`sid`),
INDEX `service` (`service`), INDEX `service` (`service`(32)),
INDEX `iid` (`iid`) INDEX `iid` (`iid`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -602,11 +604,10 @@ CREATE TABLE IF NOT EXISTS `mail` (
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`), INDEX `uid` (`uid`),
INDEX `guid` (`guid`), INDEX `uid_seen` (`uid`,`seen`),
INDEX `convid` (`convid`), INDEX `convid` (`convid`),
INDEX `reply` (`reply`), INDEX `uri` (`uri`(64)),
INDEX `uri` (`uri`), INDEX `parent-uri` (`parent-uri`(64))
INDEX `parent-uri` (`parent-uri`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -662,7 +663,11 @@ CREATE TABLE IF NOT EXISTS `notify` (
`name_cache` tinytext, `name_cache` tinytext,
`msg_cache` mediumtext, `msg_cache` mediumtext,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`) 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`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -675,8 +680,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
`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, `receiver-uid` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `master-parent-item` (`master-parent-item`), INDEX `master-parent-item` (`master-parent-item`)
INDEX `receiver-uid` (`receiver-uid`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -745,9 +749,9 @@ CREATE TABLE IF NOT EXISTS `photo` (
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid_contactid` (`uid`,`contact-id`), INDEX `uid_contactid` (`uid`,`contact-id`),
INDEX `uid_profile` (`uid`,`profile`), INDEX `uid_profile` (`uid`,`profile`),
INDEX `uid_album_created` (`uid`,`album`,`created`), INDEX `uid_album_created` (`uid`,`album`(32),`created`),
INDEX `resource-id` (`resource-id`), INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`(64),`created`),
INDEX `guid` (`guid`) INDEX `resource-id` (`resource-id`(64))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -839,8 +843,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
`thumb` varchar(255) NOT NULL DEFAULT '', `thumb` varchar(255) NOT NULL DEFAULT '',
`publish` tinyint(1) NOT NULL DEFAULT 0, `publish` tinyint(1) NOT NULL DEFAULT 0,
`net-publish` tinyint(1) NOT NULL DEFAULT 0, `net-publish` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`)
INDEX `hometown` (`hometown`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -912,8 +915,7 @@ CREATE TABLE IF NOT EXISTS `search` (
`uid` int(11) NOT NULL DEFAULT 0, `uid` int(11) NOT NULL DEFAULT 0,
`term` varchar(255) NOT NULL DEFAULT '', `term` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `uid` (`uid`), INDEX `uid` (`uid`)
INDEX `term` (`term`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -925,7 +927,7 @@ CREATE TABLE IF NOT EXISTS `session` (
`data` text, `data` text,
`expire` int(10) unsigned NOT NULL DEFAULT 0, `expire` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `sid` (`sid`), INDEX `sid` (`sid`(64)),
INDEX `expire` (`expire`) INDEX `expire` (`expire`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -977,12 +979,11 @@ CREATE TABLE IF NOT EXISTS `term` (
`uid` int(10) unsigned NOT NULL DEFAULT 0, `uid` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`tid`), PRIMARY KEY(`tid`),
INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`), INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`),
INDEX `uid_term_tid` (`uid`,`term`,`tid`), INDEX `uid_term_tid` (`uid`,`term`(32),`tid`),
INDEX `type_term` (`type`,`term`), INDEX `type_term` (`type`,`term`(32)),
INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`,`global`,`created`), INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
INDEX `otype_type_term_tid` (`otype`,`type`,`term`,`tid`), INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`), INDEX `guid` (`guid`(64))
INDEX `guid` (`guid`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -1022,9 +1023,6 @@ CREATE TABLE IF NOT EXISTS `thread` (
INDEX `uid_network_created` (`uid`,`network`,`created`), INDEX `uid_network_created` (`uid`,`network`,`created`),
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`), INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`), INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
INDEX `uid_gcontactid_commented` (`uid`,`gcontact-id`,`commented`),
INDEX `uid_gcontactid_created` (`uid`,`gcontact-id`,`created`),
INDEX `wall_private_received` (`wall`,`private`,`received`),
INDEX `uid_created` (`uid`,`created`), INDEX `uid_created` (`uid`,`created`),
INDEX `uid_commented` (`uid`,`commented`) INDEX `uid_commented` (`uid`,`commented`)
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
@ -1090,7 +1088,7 @@ CREATE TABLE IF NOT EXISTS `user` (
`deny_gid` mediumtext, `deny_gid` mediumtext,
`openidserver` text, `openidserver` text,
PRIMARY KEY(`uid`), PRIMARY KEY(`uid`),
INDEX `nickname` (`nickname`) INDEX `nickname` (`nickname`(32))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --
@ -1100,7 +1098,7 @@ CREATE TABLE IF NOT EXISTS `userd` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`username` varchar(255) NOT NULL, `username` varchar(255) NOT NULL,
PRIMARY KEY(`id`), PRIMARY KEY(`id`),
INDEX `username` (`username`) INDEX `username` (`username`(32))
) DEFAULT CHARSET=utf8mb4; ) DEFAULT CHARSET=utf8mb4;
-- --

View File

@ -40,7 +40,7 @@ Arguments
--- ---
Your hook callback functions will be called with at least one and possibly two arguments Your hook callback functions will be called with at least one and possibly two arguments
function myhook_function(&$a, &$b) { function myhook_function(App $a, &$b) {
} }
@ -77,9 +77,9 @@ This will include:
$a->argc = 3 $a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2'); $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Your module functions will often contain the function plugin_name_content(App &$a), which defines and returns the page body content. Your module functions will often contain the function plugin_name_content(App $a), which defines and returns the page body content.
They may also contain plugin_name_post(App &$a) which is called before the _content function and typically handles the results of POST forms. They may also contain plugin_name_post(App $a) which is called before the _content function and typically handles the results of POST forms.
You may also have plugin_name_init(App &$a) which is called very early on and often does module initialisation. You may also have plugin_name_init(App $a) which is called very early on and often does module initialisation.
Templates Templates
--- ---

View File

@ -68,7 +68,7 @@ The code will be something like:
file: mod/network.php file: mod/network.php
<?php <?php
function network_content(App &$a) { function network_content(App $a) {
$itemsmanager = new \Friendica\ItemsManager(); $itemsmanager = new \Friendica\ItemsManager();
$items = $itemsmanager->getAll(); $items = $itemsmanager->getAll();
@ -160,7 +160,7 @@ But if you want to use classes from another library, you need to use the full na
``` ```
<?php <?php
namespace \Frienidca; namespace \Friendica;
class Diaspora { class Diaspora {
public function md2bbcode() { public function md2bbcode() {
@ -173,7 +173,7 @@ if you use that class in many places of the code and you don't want to write the
``` ```
<?php <?php
namespace \Frienidca; namespace \Friendica;
use \Michelf\MarkdownExtra; use \Michelf\MarkdownExtra;

View File

@ -40,7 +40,7 @@ Argumente
Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen
function myhook_function(&$a, &$b) { function myhook_function(App $a, &$b) {
} }
@ -67,9 +67,9 @@ So würde http://example.com/plugin/arg1/arg2 nach einem Modul "plugin" suchen u
$a->argc = 3 $a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2'); $a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(App &$a), welche den Seiteninhalt definiert und zurückgibt. Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(App $a), welche den Seiteninhalt definiert und zurückgibt.
Sie können auch plugin_name_post(App &$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt. Sie können auch plugin_name_post(App $a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
Du kannst ebenso plugin_name_init(App &$a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert. Du kannst ebenso plugin_name_init(App $a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
Derzeitige Hooks Derzeitige Hooks

View File

@ -25,6 +25,7 @@ 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. * **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". * **birthday_input_format** - Default value is "ymd".
* **block_local_dir** (Boolean) - Blocks the access to the directory of the local users. * **block_local_dir** (Boolean) - Blocks the access to the directory of the local users.
* **dbclean** (Boolean) - Enable the automatic database cleanup process
* **default_service_class** - * **default_service_class** -
* **delivery_batch_count** - Number of deliveries per process. Default value is 1. (Disabled when using the worker) * **delivery_batch_count** - Number of deliveries per process. Default value is 1. (Disabled when using the worker)
* **diaspora_test** (Boolean) - For development only. Disables the message transfer. * **diaspora_test** (Boolean) - For development only. Disables the message transfer.
@ -45,7 +46,8 @@ Example: To set the directory value please add this line to your .htconfig.php:
* **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20. * **max_processes_frontend** - Maximum number of concurrent database processes for foreground tasks. Default value is 20.
* **memcache** (Boolean) - Use memcache. To use memcache the PECL extension "memcache" has to be installed and activated. * **memcache** (Boolean) - Use memcache. To use memcache the PECL extension "memcache" has to be installed and activated.
* **memcache_host** - Hostname of the memcache daemon. Default is '127.0.0.1'. * **memcache_host** - Hostname of the memcache daemon. Default is '127.0.0.1'.
* **memcache_port** - Portnumberof the memcache daemon. Default is 11211. * **memcache_port** - Portnumber of the memcache daemon. Default is 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_oembed** (Boolean) - Don't use OEmbed to fetch more information about a link.
* **no_oembed_rich_content** (Boolean) - Don't show the rich content (e.g. embedded PDF). * **no_oembed_rich_content** (Boolean) - Don't show the rich content (e.g. embedded PDF).
* **no_smilies** (Boolean) - Don't show smilies. * **no_smilies** (Boolean) - Don't show smilies.

View File

@ -122,7 +122,7 @@ the 1st part of the line is the name of the CSS file (without the .css) the 2nd
Calling the t() function with the common name makes the string translateable. Calling the t() function with the common name makes the string translateable.
The selected 1st part will be saved in the database by the theme_post function. The selected 1st part will be saved in the database by the theme_post function.
function theme_post(App &$a){ function theme_post(App $a){
// non local users shall not pass // non local users shall not pass
if (! local_user()) { if (! local_user()) {
return; return;
@ -168,7 +168,7 @@ The content of this file should be something like
<?php <?php
/* meta informations for the theme, see below */ /* meta informations for the theme, see below */
function duepuntozero_lr_init(App &$a) { function duepuntozero_lr_init(App $a) {
$a-> theme_info = array( $a-> theme_info = array(
'extends' => 'duepuntozero'. 'extends' => 'duepuntozero'.
); );
@ -251,7 +251,7 @@ Next crucial part of the theme.php file is a definition of an init function.
The name of the function is <theme-name>_init. The name of the function is <theme-name>_init.
So in the case of quattro it is So in the case of quattro it is
function quattro_init(App &$a) { function quattro_init(App $a) {
$a->theme_info = array(); $a->theme_info = array();
set_template_engine($a, 'smarty3'); set_template_engine($a, 'smarty3');
} }

View File

@ -612,7 +612,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
* *
* @return string posts in HTML * @return string posts in HTML
*/ */
function posts_from_gcontact($a, $gcontact_id) { function posts_from_gcontact(App $a, $gcontact_id) {
require_once('include/conversation.php'); require_once('include/conversation.php');
@ -636,7 +636,7 @@ function posts_from_gcontact($a, $gcontact_id) {
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`, $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
`author-name` AS `name`, `owner-avatar` AS `photo`, `author-name` AS `name`, `owner-avatar` AS `photo`,
`owner-link` AS `url`, `owner-avatar` AS `thumb` `owner-link` AS `url`, `owner-avatar` AS `thumb`
FROM `item` FORCE INDEX (`gcontactid_uid_created`) FROM `item`
WHERE `gcontact-id` = %d AND $sql AND WHERE `gcontact-id` = %d AND $sql AND
NOT `deleted` AND NOT `moderated` AND `visible` NOT `deleted` AND NOT `moderated` AND `visible`
ORDER BY `item`.`created` DESC LIMIT %d, %d", ORDER BY `item`.`created` DESC LIMIT %d, %d",
@ -664,7 +664,7 @@ function posts_from_gcontact($a, $gcontact_id) {
* *
* @return string posts in HTML * @return string posts in HTML
*/ */
function posts_from_contact_url($a, $contact_url) { function posts_from_contact_url(App $a, $contact_url) {
require_once('include/conversation.php'); require_once('include/conversation.php');

View File

@ -943,7 +943,7 @@ function scale_image($width, $height, $max) {
return array("width" => $dest_width, "height" => $dest_height); return array("width" => $dest_width, "height" => $dest_height);
} }
function store_photo($a, $uid, $imagedata = "", $url = "") { function store_photo(App $a, $uid, $imagedata = "", $url = "") {
$r = q("SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid` $r = q("SELECT `user`.`nickname`, `user`.`page-flags`, `contact`.`id` FROM `user` INNER JOIN `contact` on `user`.`uid` = `contact`.`uid`
WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1", WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
intval($uid)); intval($uid));

View File

@ -135,7 +135,7 @@ function contact_selector($selname, $selclass, $preselected = false, $options) {
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"" . $x['size'] . "$\" $tabindex >\r\n";
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
$sql_extra $sql_extra
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
intval(local_user()) intval(local_user())
@ -210,7 +210,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n"; $o .= "<select name=\"{$selname}[]\" id=\"$selclass\" class=\"$selclass\" multiple=\"multiple\" size=\"$size\" $tabindex >\r\n";
$r = q("SELECT `id`, `name`, `url`, `network` FROM `contact` $r = q("SELECT `id`, `name`, `url`, `network` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
$sql_extra $sql_extra
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
intval(local_user()) intval(local_user())
@ -372,7 +372,7 @@ function populate_acl($user = null, $show_jotnets = false) {
} }
function construct_acl_data(&$a, $user) { function construct_acl_data(App $a, $user) {
// Get group and contact information for html ACL selector // Get group and contact information for html ACL selector
$acl_data = acl_lookup($a, 'html'); $acl_data = acl_lookup($a, 'html');
@ -404,7 +404,7 @@ function construct_acl_data(&$a, $user) {
} }
function acl_lookup(&$a, $out_type = 'json') { function acl_lookup(App $a, $out_type = 'json') {
if (!local_user()) { if (!local_user()) {
return ''; return '';
@ -449,8 +449,8 @@ function acl_lookup(&$a, $out_type = 'json') {
// autocomplete for editor mentions // autocomplete for editor mentions
if ($type=='' || $type=='c'){ if ($type=='' || $type=='c'){
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND NOT `self`
AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND NOT `blocked` AND NOT `pending` AND NOT `archive`
AND `notify` != '' $sql_extra2" , AND `notify` != '' $sql_extra2" ,
intval(local_user()) intval(local_user())
); );
@ -461,8 +461,8 @@ function acl_lookup(&$a, $out_type = 'json') {
// autocomplete for Private Messages // autocomplete for Private Messages
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND NOT `self`
AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND NOT `blocked` AND NOT `pending` AND NOT `archive`
AND `network` IN ('%s','%s','%s') $sql_extra2" , AND `network` IN ('%s','%s','%s') $sql_extra2" ,
intval(local_user()), intval(local_user()),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
@ -477,8 +477,8 @@ function acl_lookup(&$a, $out_type = 'json') {
// autocomplete for Contacts // autocomplete for Contacts
$r = q("SELECT COUNT(*) AS c FROM `contact` $r = q("SELECT COUNT(*) AS c FROM `contact`
WHERE `uid` = %d AND `self` = 0 WHERE `uid` = %d AND NOT `self`
AND `pending` = 0 $sql_extra2" , AND NOT `pending` $sql_extra2" ,
intval(local_user()) intval(local_user())
); );
$contact_count = (int)$r[0]['c']; $contact_count = (int)$r[0]['c'];
@ -525,7 +525,7 @@ function acl_lookup(&$a, $out_type = 'json') {
if ($type==''){ if ($type==''){
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
AND NOT (`network` IN ('%s', '%s')) AND NOT (`network` IN ('%s', '%s'))
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -536,7 +536,7 @@ function acl_lookup(&$a, $out_type = 'json') {
elseif ($type=='c'){ elseif ($type=='c'){
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag`, `forum`, `prv` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 AND `notify` != '' WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `notify` != ''
AND NOT (`network` IN ('%s')) AND NOT (`network` IN ('%s'))
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -546,7 +546,7 @@ function acl_lookup(&$a, $out_type = 'json') {
} }
elseif($type == 'm') { elseif($type == 'm') {
$r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact` $r = q("SELECT `id`, `name`, `nick`, `micro`, `network`, `url`, `attag` FROM `contact`
WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 WHERE `uid` = %d AND NOT `self` AND NOT `blocked` AND NOT `pending` AND NOT `archive`
AND `network` IN ('%s','%s','%s') AND `network` IN ('%s','%s','%s')
$sql_extra2 $sql_extra2
ORDER BY `name` ASC ", ORDER BY `name` ASC ",
@ -691,7 +691,7 @@ function acl_lookup(&$a, $out_type = 'json') {
* @param App $a * @param App $a
* @return array with the search results * @return array with the search results
*/ */
function navbar_complete(App &$a) { function navbar_complete(App $a) {
// logger('navbar_complete'); // logger('navbar_complete');

View File

@ -133,7 +133,7 @@
* @hook 'logged_in' * @hook 'logged_in'
* array $user logged user record * array $user logged user record
*/ */
function api_login(App &$a){ function api_login(App $a){
// login with oauth // login with oauth
try{ try{
$oauth = new FKOAuth1(); $oauth = new FKOAuth1();
@ -251,7 +251,7 @@
* @param App $a * @param App $a
* @return string API call result * @return string API call result
*/ */
function api_call(App &$a){ function api_call(App $a){
global $API, $called_api; global $API, $called_api;
$type="json"; $type="json";
@ -404,7 +404,7 @@
* @param array $user_info * @param array $user_info
* @return array * @return array
*/ */
function api_rss_extra(&$a, $arr, $user_info){ function api_rss_extra(App $a, $arr, $user_info){
if (is_null($user_info)) $user_info = api_get_user($a); if (is_null($user_info)) $user_info = api_get_user($a);
$arr['$user'] = $user_info; $arr['$user'] = $user_info;
$arr['$rss'] = array( $arr['$rss'] = array(
@ -444,7 +444,7 @@
* @param int|string $contact_id Contact ID or URL * @param int|string $contact_id Contact ID or URL
* @param string $type Return type (for errors) * @param string $type Return type (for errors)
*/ */
function api_get_user(&$a, $contact_id = Null, $type = "json"){ function api_get_user(App $a, $contact_id = Null, $type = "json"){
global $called_api; global $called_api;
$user = null; $user = null;
$extra_query = ""; $extra_query = "";
@ -712,7 +712,7 @@
* @param array $item : item from db * @param array $item : item from db
* @return array(array:author, array:owner) * @return array(array:author, array:owner)
*/ */
function api_item_get_user(&$a, $item) { function api_item_get_user(App $a, $item) {
$status_user = api_get_user($a, $item["author-link"]); $status_user = api_get_user($a, $item["author-link"]);

View File

@ -466,7 +466,7 @@ function item_condition() {
*/ */
if(!function_exists('conversation')) { if(!function_exists('conversation')) {
function conversation(&$a, $items, $mode, $update, $preview = false) { function conversation(App $a, $items, $mode, $update, $preview = false) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
require_once('include/Contact.php'); require_once('include/Contact.php');

View File

@ -128,7 +128,7 @@ function cron_run(&$argv, &$argc){
proc_run(PRIORITY_LOW, 'include/expire.php'); proc_run(PRIORITY_LOW, 'include/expire.php');
proc_run(PRIORITY_LOW, 'include/dbclean.php'); proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
cron_update_photo_albums(); cron_update_photo_albums();
} }
@ -343,7 +343,7 @@ function cron_poll_contacts($argc, $argv) {
* *
* @param App $a * @param App $a
*/ */
function cron_clear_cache(App &$a) { function cron_clear_cache(App $a) {
$last = get_config('system','cache_last_cleared'); $last = get_config('system','cache_last_cleared');
@ -430,7 +430,7 @@ function cron_clear_cache(App &$a) {
* *
* @param App $a * @param App $a
*/ */
function cron_repair_diaspora(App &$a) { function cron_repair_diaspora(App $a) {
$r = q("SELECT `id`, `url` FROM `contact` $r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '') WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA)); ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));

View File

@ -3,13 +3,18 @@
* @file include/dbclean.php * @file include/dbclean.php
* @brief The script is called from time to time to clean the database entries and remove orphaned data. * @brief The script is called from time to time to clean the database entries and remove orphaned data.
*/ */
use \Friendica\Core\Config;
use \Friendica\Core\PConfig;
require_once("boot.php"); require_once("boot.php");
function dbclean_run(&$argv, &$argc) { function dbclean_run(&$argv, &$argc) {
global $a, $db; global $a, $db;
if (is_null($a)) if (is_null($a)) {
$a = new App; $a = new App;
}
if (is_null($db)) { if (is_null($db)) {
@include(".htconfig.php"); @include(".htconfig.php");
@ -18,8 +23,12 @@ function dbclean_run(&$argv, &$argc) {
unset($db_host, $db_user, $db_pass, $db_data); unset($db_host, $db_user, $db_pass, $db_data);
} }
load_config('config'); Config::load('config');
load_config('system'); Config::load('system');
if (!Config::get('system', 'dbclean', false)) {
return;
}
if ($argc == 2) { if ($argc == 2) {
$stage = intval($argv[1]); $stage = intval($argv[1]);
@ -27,7 +36,7 @@ function dbclean_run(&$argv, &$argc) {
$stage = 0; $stage = 0;
} }
if (get_config("system", "worker") AND ($stage == 0)) { if (Config::get("system", "worker") AND ($stage == 0)) {
proc_run(PRIORITY_LOW, 'include/dbclean.php', 1); proc_run(PRIORITY_LOW, 'include/dbclean.php', 1);
proc_run(PRIORITY_LOW, 'include/dbclean.php', 2); proc_run(PRIORITY_LOW, 'include/dbclean.php', 2);
proc_run(PRIORITY_LOW, 'include/dbclean.php', 3); proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
@ -48,11 +57,18 @@ function remove_orphans($stage = 0) {
$count = 0; $count = 0;
// With activated worker we split the deletion in many small tasks
if (Config::get("system", "worker")) {
$limit = 1000;
} else {
$limit = 10000;
}
if (($stage == 1) OR ($stage == 0)) { if (($stage == 1) OR ($stage == 0)) {
logger("Deleting old global item entries from item table without user copy"); logger("Deleting old global item entries from item table without user copy");
if ($db->q("SELECT `id` FROM `item` WHERE `uid` = 0 if ($db->q("SELECT `id` FROM `item` WHERE `uid` = 0
AND NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0)
AND `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY LIMIT 10000", true)) { AND `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found global item orphans: ".$count); logger("found global item orphans: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -65,7 +81,7 @@ function remove_orphans($stage = 0) {
if (($stage == 2) OR ($stage == 0)) { if (($stage == 2) OR ($stage == 0)) {
logger("Deleting items without parents"); logger("Deleting items without parents");
if ($db->q("SELECT `id` FROM `item` WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`) LIMIT 10000", true)) { if ($db->q("SELECT `id` FROM `item` WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`) LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found item orphans without parents: ".$count); logger("found item orphans without parents: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -78,7 +94,7 @@ function remove_orphans($stage = 0) {
if (($stage == 3) OR ($stage == 0)) { if (($stage == 3) OR ($stage == 0)) {
logger("Deleting orphaned data from thread table"); logger("Deleting orphaned data from thread table");
if ($db->q("SELECT `iid` FROM `thread` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`)", true)) { if ($db->q("SELECT `iid` FROM `thread` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `thread`.`iid`) LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found thread orphans: ".$count); logger("found thread orphans: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -91,7 +107,7 @@ function remove_orphans($stage = 0) {
if (($stage == 4) OR ($stage == 0)) { if (($stage == 4) OR ($stage == 0)) {
logger("Deleting orphaned data from notify table"); logger("Deleting orphaned data from notify table");
if ($db->q("SELECT `iid` FROM `notify` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`)", true)) { if ($db->q("SELECT `iid` FROM `notify` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `notify`.`iid`) LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found notify orphans: ".$count); logger("found notify orphans: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -104,7 +120,7 @@ function remove_orphans($stage = 0) {
if (($stage == 5) OR ($stage == 0)) { if (($stage == 5) OR ($stage == 0)) {
logger("Deleting orphaned data from notify-threads table"); logger("Deleting orphaned data from notify-threads table");
if ($db->q("SELECT `id` FROM `notify-threads` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`)", true)) { if ($db->q("SELECT `id` FROM `notify-threads` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`parent` = `notify-threads`.`master-parent-item`) LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found notify-threads orphans: ".$count); logger("found notify-threads orphans: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -118,7 +134,7 @@ function remove_orphans($stage = 0) {
if (($stage == 6) OR ($stage == 0)) { if (($stage == 6) OR ($stage == 0)) {
logger("Deleting orphaned data from sign table"); logger("Deleting orphaned data from sign table");
if ($db->q("SELECT `iid` FROM `sign` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`)", true)) { if ($db->q("SELECT `iid` FROM `sign` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `sign`.`iid`) LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found sign orphans: ".$count); logger("found sign orphans: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -132,7 +148,7 @@ function remove_orphans($stage = 0) {
if (($stage == 7) OR ($stage == 0)) { if (($stage == 7) OR ($stage == 0)) {
logger("Deleting orphaned data from term table"); logger("Deleting orphaned data from term table");
if ($db->q("SELECT `oid` FROM `term` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`)", true)) { if ($db->q("SELECT `oid` FROM `term` WHERE NOT EXISTS (SELECT `id` FROM `item` WHERE `item`.`id` = `term`.`oid`) LIMIT ".intval($limit), true)) {
$count = $db->num_rows(); $count = $db->num_rows();
logger("found term orphans: ".$count); logger("found term orphans: ".$count);
while ($orphan = $db->qfetch()) { while ($orphan = $db->qfetch()) {
@ -144,8 +160,8 @@ function remove_orphans($stage = 0) {
} }
// Call it again if not all entries were purged // Call it again if not all entries were purged
if (($stage != 0) AND ($count > 0) AND get_config("system", "worker")) { if (($stage != 0) AND ($count > 0) AND Config::get("system", "worker")) {
proc_run(PRIORITY_LOW, 'include/dbclean.php'); proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
} }
} }

View File

@ -586,9 +586,16 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid" => array("uid"), "uid_name" => array("uid", "name"),
"addr_uid" => array("addr", "uid"), "uid_self" => array("uid", "self"),
"nurl" => array("nurl"), "alias_uid" => array("alias(32)", "uid"),
"uid_pending" => array("uid", "pending"),
"uid_blocked" => array("uid", "blocked"),
"uid_rel_network_poll" => array("uid", "rel", "network", "poll(64)", "archive"),
"uid_network_batch" => array("uid", "network", "batch(64)"),
"addr_uid" => array("addr(32)", "uid"),
"nurl_uid" => array("nurl(32)", "uid"),
"nick_uid" => array("nick(32)", "uid"),
) )
); );
$database["conv"] = array( $database["conv"] = array(
@ -644,7 +651,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid" => array("uid"), "uid_start" => array("uid", "start"),
) )
); );
$database["fcontact"] = array( $database["fcontact"] = array(
@ -669,7 +676,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"addr" => array("addr"), "addr" => array("addr(32)"),
) )
); );
$database["ffinder"] = array( $database["ffinder"] = array(
@ -692,7 +699,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"server" => array("server"), "server" => array("server(32)"),
) )
); );
$database["fsuggest"] = array( $database["fsuggest"] = array(
@ -754,10 +761,10 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"nurl" => array("nurl"), "nurl" => array("nurl(32)"),
"name" => array("name"), "name" => array("name(32)"),
"nick" => array("nick"), "nick" => array("nick(32)"),
"addr" => array("addr"), "addr" => array("addr(32)"),
"updated" => array("updated"), "updated" => array("updated"),
) )
); );
@ -772,7 +779,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"cid_uid_gcid_zcid" => array("cid","uid","gcid","zcid"), "cid_uid_gcid_zcid" => array("UNIQUE", "cid","uid","gcid","zcid"),
"gcid" => array("gcid"), "gcid" => array("gcid"),
"zcid" => array("zcid"), "zcid" => array("zcid"),
) )
@ -799,7 +806,9 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid_gid_contactid" => array("uid","gid","contact-id"), "gid_contactid" => array("gid", "contact-id"),
"uid_contactid" => array("uid", "contact-id"),
"uid_gid_contactid" => array("UNIQUE", "uid", "gid", "contact-id"),
) )
); );
$database["gserver"] = array( $database["gserver"] = array(
@ -822,7 +831,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"nurl" => array("nurl"), "nurl" => array("nurl(32)"),
) )
); );
$database["hook"] = array( $database["hook"] = array(
@ -937,24 +946,17 @@ function db_definition($charset) {
"uid_network_received" => array("uid","network","received"), "uid_network_received" => array("uid","network","received"),
"uid_received" => array("uid","received"), "uid_received" => array("uid","received"),
"uid_network_commented" => array("uid","network","commented"), "uid_network_commented" => array("uid","network","commented"),
"uid_commented" => array("uid","commented"),
"uid_title" => array("uid","title"), "uid_title" => array("uid","title"),
"uid_thrparent" => array("uid","thr-parent"), "uid_thrparent" => array("uid","thr-parent"),
"uid_parenturi" => array("uid","parent-uri"), "uid_parenturi" => array("uid","parent-uri"),
"uid_contactid_id" => array("uid","contact-id","id"), "uid_contactid_id" => array("uid","contact-id","id"),
"uid_contactid_created" => array("uid","contact-id","created"), "uid_contactid_created" => array("uid","contact-id","created"),
"gcontactid_uid_created" => array("gcontact-id","uid","created"),
"authorid_created" => array("author-id","created"), "authorid_created" => array("author-id","created"),
"ownerid_created" => array("owner-id","created"),
"wall_body" => array("wall","body(6)"),
"uid_visible_moderated_created" => array("uid","visible","moderated","created"),
"uid_uri" => array("uid", "uri"), "uid_uri" => array("uid", "uri"),
"uid_wall_created" => array("uid","wall","created"), "uid_wall_created" => array("uid","wall","created"),
"resource-id" => array("resource-id"), "resource-id" => array("resource-id"),
"uid_type" => array("uid","type"), "uid_type" => array("uid","type"),
"uid_starred_id" => array("uid","starred", "id"),
"contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"), "contactid_allowcid_allowpid_denycid_denygid" => array("contact-id","allow_cid(10)","allow_gid(10)","deny_cid(10)","deny_gid(10)"),
"uid_wall_parent_created" => array("uid","wall","parent","created"),
"uid_type_changed" => array("uid","type","changed"), "uid_type_changed" => array("uid","type","changed"),
"contactid_verb" => array("contact-id","verb"), "contactid_verb" => array("contact-id","verb"),
"deleted_changed" => array("deleted","changed"), "deleted_changed" => array("deleted","changed"),
@ -976,7 +978,7 @@ function db_definition($charset) {
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid" => array("uid"), "uid" => array("uid"),
"sid" => array("sid"), "sid" => array("sid"),
"service" => array("service"), "service" => array("service(32)"),
"iid" => array("iid"), "iid" => array("iid"),
) )
); );
@ -1014,11 +1016,10 @@ function db_definition($charset) {
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid" => array("uid"), "uid" => array("uid"),
"guid" => array("guid"), "uid_seen" => array("uid", "seen"),
"convid" => array("convid"), "convid" => array("convid"),
"reply" => array("reply"), "uri" => array("uri(64)"),
"uri" => array("uri"), "parent-uri" => array("parent-uri(64)"),
"parent-uri" => array("parent-uri"),
) )
); );
$database["mailacct"] = array( $database["mailacct"] = array(
@ -1074,7 +1075,11 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid" => array("uid"), "uid_hash" => array("uid", "hash"),
"uid_seen_date" => array("uid", "seen", "date"),
"uid_type_link" => array("uid", "type", "link"),
"uid_link" => array("uid", "link"),
"uid_date" => array("uid", "date"),
) )
); );
$database["notify-threads"] = array( $database["notify-threads"] = array(
@ -1088,7 +1093,6 @@ function db_definition($charset) {
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"master-parent-item" => array("master-parent-item"), "master-parent-item" => array("master-parent-item"),
"receiver-uid" => array("receiver-uid"),
) )
); );
$database["oembed"] = array( $database["oembed"] = array(
@ -1157,9 +1161,9 @@ function db_definition($charset) {
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid_contactid" => array("uid", "contact-id"), "uid_contactid" => array("uid", "contact-id"),
"uid_profile" => array("uid", "profile"), "uid_profile" => array("uid", "profile"),
"uid_album_created" => array("uid", "album", "created"), "uid_album_created" => array("uid", "album(32)", "created"),
"resource-id" => array("resource-id"), "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
"guid" => array("guid"), "resource-id" => array("resource-id(64)"),
) )
); );
$database["poll"] = array( $database["poll"] = array(
@ -1252,7 +1256,6 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"hometown" => array("hometown"),
) )
); );
$database["profile_check"] = array( $database["profile_check"] = array(
@ -1325,7 +1328,6 @@ function db_definition($charset) {
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"uid" => array("uid"), "uid" => array("uid"),
"term" => array("term"),
) )
); );
$database["session"] = array( $database["session"] = array(
@ -1337,7 +1339,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"sid" => array("sid"), "sid" => array("sid(64)"),
"expire" => array("expire"), "expire" => array("expire"),
) )
); );
@ -1389,12 +1391,11 @@ function db_definition($charset) {
"indexes" => array( "indexes" => array(
"PRIMARY" => array("tid"), "PRIMARY" => array("tid"),
"oid_otype_type_term" => array("oid","otype","type","term"), "oid_otype_type_term" => array("oid","otype","type","term"),
"uid_term_tid" => array("uid","term","tid"), "uid_term_tid" => array("uid","term(32)","tid"),
"type_term" => array("type","term"), "type_term" => array("type","term(32)"),
"uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"), "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
"otype_type_term_tid" => array("otype","type","term","tid"), "uid_otype_type_url" => array("uid","otype","type","url(64)"),
"uid_otype_type_url" => array("uid","otype","type","url"), "guid" => array("guid(64)"),
"guid" => array("guid"),
) )
); );
$database["thread"] = array( $database["thread"] = array(
@ -1434,9 +1435,6 @@ function db_definition($charset) {
"uid_network_created" => array("uid","network","created"), "uid_network_created" => array("uid","network","created"),
"uid_contactid_commented" => array("uid","contact-id","commented"), "uid_contactid_commented" => array("uid","contact-id","commented"),
"uid_contactid_created" => array("uid","contact-id","created"), "uid_contactid_created" => array("uid","contact-id","created"),
"uid_gcontactid_commented" => array("uid","gcontact-id","commented"),
"uid_gcontactid_created" => array("uid","gcontact-id","created"),
"wall_private_received" => array("wall","private","received"),
"uid_created" => array("uid","created"), "uid_created" => array("uid","created"),
"uid_commented" => array("uid","commented"), "uid_commented" => array("uid","commented"),
) )
@ -1502,7 +1500,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("uid"), "PRIMARY" => array("uid"),
"nickname" => array("nickname"), "nickname" => array("nickname(32)"),
) )
); );
$database["userd"] = array( $database["userd"] = array(
@ -1512,7 +1510,7 @@ function db_definition($charset) {
), ),
"indexes" => array( "indexes" => array(
"PRIMARY" => array("id"), "PRIMARY" => array("id"),
"username" => array("username"), "username" => array("username(32)"),
) )
); );
$database["workerqueue"] = array( $database["workerqueue"] = array(

View File

@ -325,8 +325,9 @@ class Diaspora {
logger("delivering to: ".$rr["username"]); logger("delivering to: ".$rr["username"]);
self::dispatch($rr,$msg); self::dispatch($rr,$msg);
} }
} else } else {
logger("No subscribers for ".$msg["author"]." ".print_r($msg, true)); logger("No subscribers for ".$msg["author"]." ".print_r($msg, true), LOGGER_DEBUG);
}
return $message_id; return $message_id;
} }
@ -736,13 +737,28 @@ class Diaspora {
* @return The contact id * @return The contact id
*/ */
private static function contact_by_handle($uid, $handle) { private static function contact_by_handle($uid, $handle) {
// First do a direct search on the contact table
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
intval($uid), intval($uid),
dbesc($handle) dbesc($handle)
); );
if ($r) if (dbm::is_result($r)) {
return $r[0]; return $r[0];
} else {
// We haven't found it?
// We use another function for it that will possibly create a contact entry
$cid = get_contact($handle, $uid);
if ($cid > 0) {
$r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1", intval($cid));
if (dbm::is_result($r)) {
return $r[0];
}
}
}
$handle_parts = explode("@", $handle); $handle_parts = explode("@", $handle);
$nurl_sql = "%%://".$handle_parts[1]."%%/profile/".$handle_parts[0]; $nurl_sql = "%%://".$handle_parts[1]."%%/profile/".$handle_parts[0];
@ -751,9 +767,11 @@ class Diaspora {
intval($uid), intval($uid),
dbesc($nurl_sql) dbesc($nurl_sql)
); );
if($r) if (dbm::is_result($r)) {
return $r[0]; return $r[0];
}
logger("Haven't found contact for user ".$uid." and handle ".$handle, LOGGER_DEBUG);
return false; return false;
} }
@ -833,7 +851,7 @@ class Diaspora {
dbesc($guid) dbesc($guid)
); );
if ($r) { if (dbm::is_result($r)) {
logger("message ".$guid." already exists for user ".$uid); logger("message ".$guid." already exists for user ".$uid);
return $r[0]["id"]; return $r[0]["id"];
} }

View File

@ -105,7 +105,7 @@ function notification($params) {
// If so don't create a second notification // If so don't create a second notification
$p = null; $p = null;
$p = q("SELECT `id` FROM `notify` WHERE (`type` = %d OR `type` = %d OR `type` = %d) AND `link` = '%s' AND `uid` = %d LIMIT 1", $p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d, %d) AND `link` = '%s' AND `uid` = %d LIMIT 1",
intval(NOTIFY_TAGSELF), intval(NOTIFY_TAGSELF),
intval(NOTIFY_COMMENT), intval(NOTIFY_COMMENT),
intval(NOTIFY_SHARE), intval(NOTIFY_SHARE),
@ -472,7 +472,7 @@ function notification($params) {
// After we've stored everything, look again to see if there are any duplicates and if so remove them // After we've stored everything, look again to see if there are any duplicates and if so remove them
$p = null; $p = null;
$p = q("SELECT `id` FROM `notify` WHERE (`type` = %d OR `type` = %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`", $p = q("SELECT `id` FROM `notify` WHERE `type` IN (%d, %d) AND `link` = '%s' AND `uid` = %d ORDER BY `id`",
intval(NOTIFY_TAGSELF), intval(NOTIFY_TAGSELF),
intval(NOTIFY_COMMENT), intval(NOTIFY_COMMENT),
dbesc($params['link']), dbesc($params['link']),

View File

@ -206,7 +206,7 @@ function bbtoevent($s) {
} }
function sort_by_date(App &$a) { function sort_by_date(App $a) {
usort($a,'ev_compare'); usort($a,'ev_compare');
return $a; return $a;

View File

@ -31,7 +31,7 @@ require_once("mod/proxy.php");
* @param int $profile * @param int $profile
* @param array $profiledata * @param array $profiledata
*/ */
function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) { function profile_load(App $a, $nickname, $profile = 0, $profiledata = array()) {
$user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1", $user = q("SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1",
dbesc($nickname) dbesc($nickname)
@ -598,7 +598,7 @@ function get_events() {
)); ));
} }
function advanced_profile(App &$a) { function advanced_profile(App $a) {
$o = ''; $o = '';
$uid = $a->profile['uid']; $uid = $a->profile['uid'];
@ -755,7 +755,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array( array(
'label'=>t('Status'), 'label'=>t('Status'),
'url' => $url, 'url' => $url,
'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''), 'sel' => ((!isset($tab) && $a->argv[0]=='profile')?'active':''),
'title' => t('Status Messages and Posts'), 'title' => t('Status Messages and Posts'),
'id' => 'status-tab', 'id' => 'status-tab',
'accesskey' => 'm', 'accesskey' => 'm',
@ -771,7 +771,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array( array(
'label' => t('Photos'), 'label' => t('Photos'),
'url' => App::get_baseurl() . '/photos/' . $nickname, 'url' => App::get_baseurl() . '/photos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='photos')?'active':''), 'sel' => ((!isset($tab) && $a->argv[0]=='photos')?'active':''),
'title' => t('Photo Albums'), 'title' => t('Photo Albums'),
'id' => 'photo-tab', 'id' => 'photo-tab',
'accesskey' => 'h', 'accesskey' => 'h',
@ -779,7 +779,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
array( array(
'label' => t('Videos'), 'label' => t('Videos'),
'url' => App::get_baseurl() . '/videos/' . $nickname, 'url' => App::get_baseurl() . '/videos/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='videos')?'active':''), 'sel' => ((!isset($tab) && $a->argv[0]=='videos')?'active':''),
'title' => t('Videos'), 'title' => t('Videos'),
'id' => 'video-tab', 'id' => 'video-tab',
'accesskey' => 'v', 'accesskey' => 'v',
@ -791,7 +791,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array( $tabs[] = array(
'label' => t('Events'), 'label' => t('Events'),
'url' => App::get_baseurl() . '/events', 'url' => App::get_baseurl() . '/events',
'sel' =>((!isset($tab)&&$a->argv[0]=='events')?'active':''), 'sel' =>((!isset($tab) && $a->argv[0]=='events')?'active':''),
'title' => t('Events and Calendar'), 'title' => t('Events and Calendar'),
'id' => 'events-tab', 'id' => 'events-tab',
'accesskey' => 'e', 'accesskey' => 'e',
@ -802,7 +802,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array( $tabs[] = array(
'label' => t('Events'), 'label' => t('Events'),
'url' => App::get_baseurl() . '/cal/' . $nickname, 'url' => App::get_baseurl() . '/cal/' . $nickname,
'sel' =>((!isset($tab)&&$a->argv[0]=='cal')?'active':''), 'sel' =>((!isset($tab) && $a->argv[0]=='cal')?'active':''),
'title' => t('Events and Calendar'), 'title' => t('Events and Calendar'),
'id' => 'events-tab', 'id' => 'events-tab',
'accesskey' => 'e', 'accesskey' => 'e',
@ -813,7 +813,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array( $tabs[] = array(
'label' => t('Personal Notes'), 'label' => t('Personal Notes'),
'url' => App::get_baseurl() . '/notes', 'url' => App::get_baseurl() . '/notes',
'sel' =>((!isset($tab)&&$a->argv[0]=='notes')?'active':''), 'sel' =>((!isset($tab) && $a->argv[0]=='notes')?'active':''),
'title' => t('Only You Can See This'), 'title' => t('Only You Can See This'),
'id' => 'notes-tab', 'id' => 'notes-tab',
'accesskey' => 't', 'accesskey' => 't',
@ -824,7 +824,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
$tabs[] = array( $tabs[] = array(
'label' => t('Contacts'), 'label' => t('Contacts'),
'url' => App::get_baseurl() . '/viewcontacts/' . $nickname, 'url' => App::get_baseurl() . '/viewcontacts/' . $nickname,
'sel' => ((!isset($tab)&&$a->argv[0]=='viewcontacts')?'active':''), 'sel' => ((!isset($tab) && $a->argv[0]=='viewcontacts')?'active':''),
'title' => t('Contacts'), 'title' => t('Contacts'),
'id' => 'viewcontacts-tab', 'id' => 'viewcontacts-tab',
'accesskey' => 'k', 'accesskey' => 'k',
@ -845,7 +845,7 @@ function get_my_url() {
return false; return false;
} }
function zrl_init(App &$a) { function zrl_init(App $a) {
$tmp_str = get_my_url(); $tmp_str = get_my_url();
if(validate_url($tmp_str)) { if(validate_url($tmp_str)) {

View File

@ -1,6 +1,6 @@
<?php <?php
function nav(App &$a) { function nav(App $a) {
/* /*
* *

View File

@ -2072,7 +2072,7 @@ class ostatus {
* *
* @return string XML feed * @return string XML feed
*/ */
public static function feed(&$a, $owner_nick, $last_update) { public static function feed(App $a, $owner_nick, $last_update) {
$r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags` $r = q("SELECT `contact`.*, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`

View File

@ -4,6 +4,9 @@
* @brief Functions related to photo handling. * @brief Functions related to photo handling.
*/ */
use \Friendica\Core\Config;
use \Friendica\Core\PConfig;
function getGps($exifCoord, $hemi) { function getGps($exifCoord, $hemi) {
$degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0; $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
$minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0; $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0;
@ -42,6 +45,7 @@ function photo_albums($uid, $update = false) {
$key = "photo_albums:".$uid.":".local_user().":".remote_user(); $key = "photo_albums:".$uid.":".local_user().":".remote_user();
$albums = Cache::get($key); $albums = Cache::get($key);
if (is_null($albums) OR $update) { if (is_null($albums) OR $update) {
if (!Config::get('system', 'no_count', false)) {
/// @todo This query needs to be renewed. It is really slow /// @todo This query needs to be renewed. It is really slow
// At this time we just store the data in the cache // At this time we just store the data in the cache
$albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album` $albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`
@ -52,6 +56,17 @@ function photo_albums($uid, $update = false) {
dbesc('Contact Photos'), dbesc('Contact Photos'),
dbesc(t('Contact Photos')) dbesc(t('Contact Photos'))
); );
} else {
// This query doesn't do the count and is much faster
$albums = qu("SELECT DISTINCT(`album`), '' AS `total`
FROM `photo` USE INDEX (`uid_album_created`)
WHERE `uid` = %d AND `album` != '%s' AND `album` != '%s' $sql_extra
GROUP BY `album` ORDER BY `created` DESC",
intval($uid),
dbesc('Contact Photos'),
dbesc(t('Contact Photos'))
);
}
Cache::set($key, $albums, CACHE_DAY); Cache::set($key, $albums, CACHE_DAY);
} }
return $albums; return $albums;

View File

@ -296,7 +296,7 @@ function shortenmsg($msg, $limit, $twitter = false) {
* *
* @return string The converted message * @return string The converted message
*/ */
function plaintext($a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = "") { function plaintext(App $a, $b, $limit = 0, $includedlinks = false, $htmlmode = 2, $target_network = "") {
// Remove the hash tags // Remove the hash tags
$URLSearchString = "^\[\]"; $URLSearchString = "^\[\]";

View File

@ -1,6 +1,6 @@
<?php <?php
function auto_redir(&$a, $contact_nick) { function auto_redir(App $a, $contact_nick) {
// prevent looping // prevent looping
@ -27,9 +27,9 @@ function auto_redir(&$a, $contact_nick) {
$baseurl = substr($baseurl, $domain_st + 3); $baseurl = substr($baseurl, $domain_st + 3);
$nurl = normalise_link($baseurl); $nurl = normalise_link($baseurl);
/// @todo Why is there a query for "url" *and* "nurl"? Especially this normalising is strange.
$r = q("SELECT id FROM contact WHERE uid = ( SELECT uid FROM user WHERE nickname = '%s' LIMIT 1 ) $r = q("SELECT `id` FROM `contact` WHERE `uid` = (SELECT `uid` FROM `user` WHERE `nickname` = '%s' LIMIT 1)
AND nick = '%s' AND self = 0 AND ( url LIKE '%%%s%%' or nurl LIKE '%%%s%%' ) AND blocked = 0 AND pending = 0 LIMIT 1", AND `nick` = '%s' AND NOT `self` AND (`url` LIKE '%%%s%%' OR `nurl` LIKE '%%%s%%') AND NOT `blocked` AND NOT `pending` LIMIT 1",
dbesc($contact_nick), dbesc($contact_nick),
dbesc($a->user['nickname']), dbesc($a->user['nickname']),
dbesc($baseurl), dbesc($baseurl),

View File

@ -106,7 +106,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive
function can_write_wall(&$a,$owner) { function can_write_wall(App $a, $owner) {
static $verified = 0; static $verified = 0;

View File

@ -276,7 +276,7 @@ if(! function_exists('paginate_data')) {
* @param int $count [optional] item count (used with alt pager) * @param int $count [optional] item count (used with alt pager)
* @return Array data for pagination template * @return Array data for pagination template
*/ */
function paginate_data(&$a, $count=null) { function paginate_data(App $a, $count=null) {
$stripped = preg_replace('/([&?]page=[0-9]*)/','',$a->query_string); $stripped = preg_replace('/([&?]page=[0-9]*)/','',$a->query_string);
$stripped = str_replace('q=','',$stripped); $stripped = str_replace('q=','',$stripped);
@ -369,7 +369,7 @@ if(! function_exists('paginate')) {
* @param App $a App instance * @param App $a App instance
* @return string html for pagination #FIXME remove html * @return string html for pagination #FIXME remove html
*/ */
function paginate(App &$a) { function paginate(App $a) {
$data = paginate_data($a); $data = paginate_data($a);
$tpl = get_markup_template("paginate.tpl"); $tpl = get_markup_template("paginate.tpl");
@ -384,7 +384,7 @@ if(! function_exists('alt_pager')) {
* @param int $i * @param int $i
* @return string html for pagination #FIXME remove html * @return string html for pagination #FIXME remove html
*/ */
function alt_pager(&$a, $i) { function alt_pager(App $a, $i) {
$data = paginate_data($a, $i); $data = paginate_data($a, $i);
$tpl = get_markup_template("paginate.tpl"); $tpl = get_markup_template("paginate.tpl");

View File

@ -78,7 +78,7 @@ function import_cleanup($newuid) {
q("DELETE FROM `pconfig` WHERE uid = %d", $newuid); q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);
} }
function import_account(&$a, $file) { function import_account(App $a, $file) {
logger("Start user import from " . $file['tmp_name']); logger("Start user import from " . $file['tmp_name']);
/* /*
STEPS STEPS

View File

@ -3,7 +3,7 @@
require_once("mod/hostxrd.php"); require_once("mod/hostxrd.php");
require_once("mod/nodeinfo.php"); require_once("mod/nodeinfo.php");
function _well_known_init(App &$a){ function _well_known_init(App $a) {
if ($a->argc > 1) { if ($a->argc > 1) {
switch($a->argv[1]) { switch($a->argv[1]) {
case "host-meta": case "host-meta":
@ -21,7 +21,7 @@ function _well_known_init(App &$a){
killme(); killme();
} }
function wk_social_relay(App &$a) { function wk_social_relay(App $a) {
define('SR_SCOPE_ALL', 'all'); define('SR_SCOPE_ALL', 'all');
define('SR_SCOPE_TAGS', 'tags'); define('SR_SCOPE_TAGS', 'tags');

View File

@ -2,7 +2,7 @@
require_once('include/Scrape.php'); require_once('include/Scrape.php');
function acctlink_init(App &$a) { function acctlink_init(App $a) {
if(x($_GET,'addr')) { if(x($_GET,'addr')) {
$addr = trim($_GET['addr']); $addr = trim($_GET['addr']);

View File

@ -3,7 +3,7 @@
require_once("include/acl_selectors.php"); require_once("include/acl_selectors.php");
function acl_init(App &$a){ function acl_init(App $a) {
acl_lookup($a); acl_lookup($a);
} }

View File

@ -23,7 +23,7 @@ require_once("include/text.php");
* @param App $a * @param App $a
* *
*/ */
function admin_post(App &$a){ function admin_post(App $a) {
if(!is_site_admin()) { if(!is_site_admin()) {
@ -66,7 +66,7 @@ function admin_post(App &$a){
$theme = $a->argv[2]; $theme = $a->argv[2];
if(is_file("view/theme/$theme/config.php")){ if(is_file("view/theme/$theme/config.php")){
function __call_theme_admin_post(&$a, $theme) { function __call_theme_admin_post(App $a, $theme) {
$orig_theme = $a->theme; $orig_theme = $a->theme;
$orig_page = $a->page; $orig_page = $a->page;
$orig_session_theme = $_SESSION['theme']; $orig_session_theme = $_SESSION['theme'];
@ -127,7 +127,7 @@ function admin_post(App &$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_content(App &$a) { function admin_content(App $a) {
if(!is_site_admin()) { if(!is_site_admin()) {
return login(false); return login(false);
@ -260,7 +260,7 @@ function admin_content(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_federation(App &$a) { function admin_page_federation(App $a) {
// get counts on active friendica, diaspora, redmatrix, hubzilla, gnu // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
// social and statusnet nodes this node is knowing // social and statusnet nodes this node is knowing
// //
@ -393,7 +393,7 @@ function admin_page_federation(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_queue(App &$a) { function admin_page_queue(App $a) {
// get content from the queue table // get content from the queue table
$r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last` $r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
FROM `queue` AS `q`, `contact` AS `c` FROM `queue` AS `q`, `contact` AS `c`
@ -427,7 +427,7 @@ function admin_page_queue(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_summary(App &$a) { function admin_page_summary(App $a) {
global $db; global $db;
// are there MyISAM tables in the DB? If so, trigger a warning message // are there MyISAM tables in the DB? If so, trigger a warning message
$r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1", $r = q("SELECT `engine` FROM `information_schema`.`tables` WHERE `engine` = 'myisam' AND `table_schema` = '%s' LIMIT 1",
@ -504,7 +504,7 @@ function admin_page_summary(App &$a) {
* *
* @param App $a * @param App $a
*/ */
function admin_page_site_post(App &$a) { function admin_page_site_post(App $a) {
if(!x($_POST,"page_site")) { if(!x($_POST,"page_site")) {
return; return;
} }
@ -845,7 +845,7 @@ function admin_page_site_post(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_site(App &$a) { function admin_page_site(App $a) {
/* Installed langs */ /* Installed langs */
$lang_choices = get_available_languages(); $lang_choices = get_available_languages();
@ -1072,7 +1072,7 @@ function admin_page_site(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
**/ **/
function admin_page_dbsync(App &$a) { function admin_page_dbsync(App $a) {
$o = ''; $o = '';
@ -1155,7 +1155,7 @@ function admin_page_dbsync(App &$a) {
* *
* @param App $a * @param App $a
*/ */
function admin_page_users_post(App &$a){ function admin_page_users_post(App $a) {
$pending = (x($_POST, 'pending') ? $_POST['pending'] : array()); $pending = (x($_POST, 'pending') ? $_POST['pending'] : array());
$users = (x($_POST, 'user') ? $_POST['user'] : array()); $users = (x($_POST, 'user') ? $_POST['user'] : array());
$nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : ''); $nu_name = (x($_POST, 'new_user_name') ? $_POST['new_user_name'] : '');
@ -1260,7 +1260,7 @@ function admin_page_users_post(App &$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_users(App &$a){ function admin_page_users(App $a) {
if($a->argc>2) { if($a->argc>2) {
$uid = $a->argv[3]; $uid = $a->argv[3];
$user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid)); $user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
@ -1460,7 +1460,7 @@ function admin_page_users(App &$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_plugins(App &$a){ function admin_page_plugins(App $a) {
/* /*
* Single plugin * Single plugin
@ -1669,7 +1669,7 @@ function rebuild_theme_table($themes) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_themes(App &$a){ function admin_page_themes(App $a) {
$allowed_themes_str = get_config('system','allowed_themes'); $allowed_themes_str = get_config('system','allowed_themes');
$allowed_themes_raw = explode(',',$allowed_themes_str); $allowed_themes_raw = explode(',',$allowed_themes_str);
@ -1749,7 +1749,7 @@ function admin_page_themes(App &$a){
$admin_form=""; $admin_form="";
if(is_file("view/theme/$theme/config.php")) { if(is_file("view/theme/$theme/config.php")) {
function __get_theme_admin_form(&$a, $theme) { function __get_theme_admin_form(App $a, $theme) {
$orig_theme = $a->theme; $orig_theme = $a->theme;
$orig_page = $a->page; $orig_page = $a->page;
$orig_session_theme = $_SESSION['theme']; $orig_session_theme = $_SESSION['theme'];
@ -1850,7 +1850,7 @@ function admin_page_themes(App &$a){
* *
* @param App $a * @param App $a
*/ */
function admin_page_logs_post(App &$a) { function admin_page_logs_post(App $a) {
if (x($_POST,"page_logs")) { if (x($_POST,"page_logs")) {
check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs'); check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
@ -1884,7 +1884,7 @@ function admin_page_logs_post(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_logs(App &$a){ function admin_page_logs(App $a) {
$log_choices = array( $log_choices = array(
LOGGER_NORMAL => 'Normal', LOGGER_NORMAL => 'Normal',
@ -1941,7 +1941,7 @@ function admin_page_logs(App &$a){
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_viewlogs(App &$a){ function admin_page_viewlogs(App $a) {
$t = get_markup_template("admin_viewlogs.tpl"); $t = get_markup_template("admin_viewlogs.tpl");
$f = get_config('system','logfile'); $f = get_config('system','logfile');
$data = ''; $data = '';
@ -1983,7 +1983,7 @@ function admin_page_viewlogs(App &$a){
* *
* @param App $a * @param App $a
*/ */
function admin_page_features_post(App &$a) { function admin_page_features_post(App $a) {
check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features'); check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
@ -2029,7 +2029,7 @@ function admin_page_features_post(App &$a) {
* @param App $a * @param App $a
* @return string * @return string
*/ */
function admin_page_features(App &$a) { function admin_page_features(App $a) {
if((argc() > 1) && (argv(1) === 'features')) { if((argc() > 1) && (argv(1) === 'features')) {
$arr = array(); $arr = array();

View File

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/contacts.php'); require_once('mod/contacts.php');
function allfriends_content(App &$a) { function allfriends_content(App $a) {
$o = ''; $o = '';
if (! local_user()) { if (! local_user()) {

View File

@ -1,6 +1,6 @@
<?php <?php
function amcd_content(App &$a) { function amcd_content(App $a) {
//header("Content-type: text/json"); //header("Content-type: text/json");
echo <<< EOT echo <<< EOT
{ {

View File

@ -20,7 +20,7 @@ function oauth_get_client($request){
return $r[0]; return $r[0];
} }
function api_post(App &$a) { function api_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -34,7 +34,7 @@ function api_post(App &$a) {
} }
function api_content(App &$a) { function api_content(App $a) {
if ($a->cmd=='api/oauth/authorize'){ if ($a->cmd=='api/oauth/authorize'){
/* /*
* api/oauth/authorize interact with the user. return a standard page * api/oauth/authorize interact with the user. return a standard page

View File

@ -1,6 +1,6 @@
<?php <?php
function apps_content(App &$a) { function apps_content(App $a) {
$privateaddons = get_config('config','private_addons'); $privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") { if ($privateaddons === "1") {
if((! (local_user()))) { if((! (local_user()))) {

View File

@ -2,7 +2,7 @@
require_once('include/security.php'); require_once('include/security.php');
function attach_init(App &$a) { function attach_init(App $a) {
if($a->argc != 2) { if($a->argc != 2) {
notice( t('Item not available.') . EOL); notice( t('Item not available.') . EOL);

View File

@ -9,7 +9,7 @@ function visible_lf($s) {
return str_replace("\n",'<br />', $s); return str_replace("\n",'<br />', $s);
} }
function babel_content(App &$a) { function babel_content(App $a) {
$o .= '<h1>Babel Diagnostic</h1>'; $o .= '<h1>Babel Diagnostic</h1>';

View File

@ -3,11 +3,11 @@
require_once('include/conversation.php'); require_once('include/conversation.php');
require_once('include/items.php'); require_once('include/items.php');
function bookmarklet_init(App &$a) { function bookmarklet_init(App $a) {
$_GET["mode"] = "minimal"; $_GET["mode"] = "minimal";
} }
function bookmarklet_content(App &$a) { function bookmarklet_content(App $a) {
if (!local_user()) { if (!local_user()) {
$o = '<h2>'.t('Login').'</h2>'; $o = '<h2>'.t('Login').'</h2>';
$o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true); $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);

View File

@ -9,7 +9,7 @@
require_once('include/event.php'); require_once('include/event.php');
require_once('include/redir.php'); require_once('include/redir.php');
function cal_init(App &$a) { function cal_init(App $a) {
if($a->argc > 1) if($a->argc > 1)
auto_redir($a, $a->argv[1]); auto_redir($a, $a->argv[1]);
@ -64,7 +64,7 @@ function cal_init(App &$a) {
return; return;
} }
function cal_content(App &$a) { function cal_content(App $a) {
nav_set_selected('events'); nav_set_selected('events');
$editselect = 'none'; $editselect = 'none';

View File

@ -5,19 +5,19 @@
*/ */
function cb_init(App &$a) { function cb_init(App $a) {
call_hooks('cb_init'); call_hooks('cb_init');
} }
function cb_post(App &$a) { function cb_post(App $a) {
call_hooks('cb_post', $_POST); call_hooks('cb_post', $_POST);
} }
function cb_afterpost(App &$a) { function cb_afterpost(App $a) {
call_hooks('cb_afterpost'); call_hooks('cb_afterpost');
} }
function cb_content(App &$a) { function cb_content(App $a) {
$o = ''; $o = '';
call_hooks('cb_content', $o); call_hooks('cb_content', $o);
return $o; return $o;

View File

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/contacts.php'); require_once('mod/contacts.php');
function common_content(App &$a) { function common_content(App $a) {
$o = ''; $o = '';

View File

@ -1,6 +1,6 @@
<?php <?php
function community_init(App &$a) { function community_init(App $a) {
if (! local_user()) { if (! local_user()) {
unset($_SESSION['theme']); unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']); unset($_SESSION['mobile-theme']);
@ -10,7 +10,7 @@ function community_init(App &$a) {
} }
function community_content(&$a, $update = 0) { function community_content(App $a, $update = 0) {
$o = ''; $o = '';
@ -121,7 +121,7 @@ function community_getitems($start, $itemspage) {
return(community_getpublicitems($start, $itemspage)); return(community_getpublicitems($start, $itemspage));
$r = qu("SELECT %s $r = qu("SELECT %s
FROM `thread` FORCE INDEX (`wall_private_received`) FROM `thread`
INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall` INNER JOIN `user` ON `user`.`uid` = `thread`.`uid` AND NOT `user`.`hidewall`
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = ''

View File

@ -2,7 +2,7 @@
require_once('include/group.php'); require_once('include/group.php');
function contactgroup_content(App &$a) { function contactgroup_content(App $a) {
if (! local_user()) { if (! local_user()) {

View File

@ -7,7 +7,7 @@ require_once('include/Scrape.php');
require_once('mod/proxy.php'); require_once('mod/proxy.php');
require_once('include/Photo.php'); require_once('include/Photo.php');
function contacts_init(App &$a) { function contacts_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -97,7 +97,7 @@ function contacts_init(App &$a) {
} }
function contacts_batch_actions(App &$a){ function contacts_batch_actions(App $a) {
$contacts_id = $_POST['contact_batch']; $contacts_id = $_POST['contact_batch'];
if (!is_array($contacts_id)) return; if (!is_array($contacts_id)) return;
@ -144,7 +144,7 @@ function contacts_batch_actions(App &$a){
} }
function contacts_post(App &$a) { function contacts_post(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -349,7 +349,7 @@ function _contact_drop($contact_id, $orig_record) {
} }
function contacts_content(App &$a) { function contacts_content(App $a) {
$sort_type = 0; $sort_type = 0;
$o = ''; $o = '';

View File

@ -16,7 +16,7 @@
// and 10-20 milliseconds to fetch all the child items. // and 10-20 milliseconds to fetch all the child items.
function content_content(&$a, $update = 0) { function content_content(App $a, $update = 0) {
require_once('include/conversation.php'); require_once('include/conversation.php');
@ -307,7 +307,7 @@ function content_content(&$a, $update = 0) {
function render_content(&$a, $items, $mode, $update, $preview = false) { function render_content(App $a, $items, $mode, $update, $preview = false) {
require_once('include/bbcode.php'); require_once('include/bbcode.php');
require_once('mod/proxy.php'); require_once('mod/proxy.php');

View File

@ -5,7 +5,7 @@
* addons repository will be listed though ATM) * addons repository will be listed though ATM)
*/ */
function credits_content (App &$a) { function credits_content (App $a) {
/* fill the page with credits */ /* fill the page with credits */
$f = fopen('util/credits.txt','r'); $f = fopen('util/credits.txt','r');
$names = fread($f, filesize('util/credits.txt')); $names = fread($f, filesize('util/credits.txt'));

View File

@ -2,7 +2,7 @@
require_once("include/contact_selectors.php"); require_once("include/contact_selectors.php");
require_once("mod/contacts.php"); require_once("mod/contacts.php");
function crepair_init(App &$a) { function crepair_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -30,7 +30,7 @@ function crepair_init(App &$a) {
} }
} }
function crepair_post(App &$a) { function crepair_post(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -96,7 +96,7 @@ function crepair_post(App &$a) {
function crepair_content(App &$a) { function crepair_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -1,12 +1,12 @@
<?php <?php
require_once('mod/settings.php'); require_once('mod/settings.php');
function delegate_init(App &$a) { function delegate_init(App $a) {
return settings_init($a); return settings_init($a);
} }
function delegate_content(App &$a) { function delegate_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -22,7 +22,7 @@ require_once('include/enotify.php');
require_once('include/group.php'); require_once('include/group.php');
require_once('include/Probe.php'); require_once('include/Probe.php');
function dfrn_confirm_post(&$a,$handsfree = null) { function dfrn_confirm_post(App $a, $handsfree = null) {
if(is_array($handsfree)) { if(is_array($handsfree)) {

View File

@ -11,7 +11,7 @@ require_once('include/event.php');
require_once('library/defuse/php-encryption-1.2.1/Crypto.php'); require_once('library/defuse/php-encryption-1.2.1/Crypto.php');
function dfrn_notify_post(App &$a) { function dfrn_notify_post(App $a) {
logger(__function__, LOGGER_TRACE); logger(__function__, LOGGER_TRACE);
$dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : ''); $dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : '');
$dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0); $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
@ -221,7 +221,7 @@ function dfrn_notify_post(App &$a) {
} }
function dfrn_notify_content(App &$a) { function dfrn_notify_content(App $a) {
if(x($_GET,'dfrn_id')) { if(x($_GET,'dfrn_id')) {

View File

@ -4,7 +4,7 @@ require_once('include/auth.php');
require_once('include/dfrn.php'); require_once('include/dfrn.php');
function dfrn_poll_init(App &$a) { function dfrn_poll_init(App $a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
@ -203,7 +203,7 @@ function dfrn_poll_init(App &$a) {
function dfrn_poll_post(App &$a) { function dfrn_poll_post(App $a) {
$dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : ''); $dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : '');
$challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : ''); $challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : '');
@ -383,7 +383,7 @@ function dfrn_poll_post(App &$a) {
} }
} }
function dfrn_poll_content(App &$a) { function dfrn_poll_content(App $a) {
$dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : '');
$type = ((x($_GET,'type')) ? $_GET['type'] : 'data'); $type = ((x($_GET,'type')) ? $_GET['type'] : 'data');

View File

@ -17,7 +17,7 @@ require_once('include/Scrape.php');
require_once('include/Probe.php'); require_once('include/Probe.php');
require_once('include/group.php'); require_once('include/group.php');
function dfrn_request_init(App &$a) { function dfrn_request_init(App $a) {
if($a->argc > 1) if($a->argc > 1)
$which = $a->argv[1]; $which = $a->argv[1];
@ -42,7 +42,7 @@ function dfrn_request_init(App &$a) {
* After logging in, we click 'submit' to approve the linkage. * After logging in, we click 'submit' to approve the linkage.
* *
*/ */
function dfrn_request_post(App &$a) { function dfrn_request_post(App $a) {
if(($a->argc != 2) || (! count($a->profile))) { if(($a->argc != 2) || (! count($a->profile))) {
logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile)); logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
@ -658,7 +658,7 @@ function dfrn_request_post(App &$a) {
} }
function dfrn_request_content(App &$a) { function dfrn_request_content(App $a) {
if (($a->argc != 2) || (! count($a->profile))) { if (($a->argc != 2) || (! count($a->profile))) {
return ""; return "";

View File

@ -1,6 +1,6 @@
<?php <?php
function directory_init(App &$a) { function directory_init(App $a) {
$a->set_pager_itemspage(60); $a->set_pager_itemspage(60);
if(local_user()) { if(local_user()) {
@ -20,14 +20,14 @@ function directory_init(App &$a) {
} }
function directory_post(App &$a) { function directory_post(App $a) {
if(x($_POST,'search')) if(x($_POST,'search'))
$a->data['search'] = $_POST['search']; $a->data['search'] = $_POST['search'];
} }
function directory_content(App &$a) { function directory_content(App $a) {
global $db; global $db;
require_once("mod/proxy.php"); require_once("mod/proxy.php");

View File

@ -5,7 +5,7 @@ require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
require_once('mod/contacts.php'); require_once('mod/contacts.php');
function dirfind_init(App &$a) { function dirfind_init(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL ); notice( t('Permission denied.') . EOL );
@ -23,7 +23,7 @@ function dirfind_init(App &$a) {
function dirfind_content(&$a, $prefix = "") { function dirfind_content(App $a, $prefix = "") {
$community = false; $community = false;
$discover_user = false; $discover_user = false;

View File

@ -1,6 +1,6 @@
<?php <?php
function display_init(App &$a) { function display_init(App $a) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return; return;
@ -194,7 +194,7 @@ function display_fetchauthor($a, $item) {
return($profiledata); return($profiledata);
} }
function display_content(&$a, $update = 0) { function display_content(App $a, $update = 0) {
if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) { if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
notice(t('Public access denied.') . EOL); notice(t('Public access denied.') . EOL);

View File

@ -2,7 +2,7 @@
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');
function editpost_content(App &$a) { function editpost_content(App $a) {
$o = ''; $o = '';

View File

@ -8,7 +8,7 @@ require_once('include/datetime.php');
require_once('include/event.php'); require_once('include/event.php');
require_once('include/items.php'); require_once('include/items.php');
function events_init(App &$a) { function events_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -31,7 +31,7 @@ function events_init(App &$a) {
return; return;
} }
function events_post(App &$a) { function events_post(App $a) {
logger('post: ' . print_r($_REQUEST,true)); logger('post: ' . print_r($_REQUEST,true));
@ -189,7 +189,7 @@ function events_post(App &$a) {
function events_content(App &$a) { function events_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -10,7 +10,7 @@ require_once('include/Photo.php');
/** /**
* @param App $a * @param App $a
*/ */
function fbrowser_content(App &$a){ function fbrowser_content(App $a) {
if (!local_user()) if (!local_user())
killme(); killme();

View File

@ -6,9 +6,7 @@ require_once("include/crypto.php");
require_once("include/diaspora.php"); require_once("include/diaspora.php");
require_once("include/xml.php"); require_once("include/xml.php");
/// @TODO You always make it like this: function foo(&$a) function fetch_init(App $a) {
/// @TODO This means that the value of $a can be changed in anything, remove & and use App as type-hint
function fetch_init(App &$a){
if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) { if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found')); header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));

View File

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
function filer_content(App &$a) { function filer_content(App $a) {
if (! local_user()) { if (! local_user()) {
killme(); killme();

View File

@ -1,6 +1,6 @@
<?php <?php
function filerm_content(App &$a) { function filerm_content(App $a) {
if (! local_user()) { if (! local_user()) {
killme(); killme();

View File

@ -5,7 +5,7 @@ require_once('include/follow.php');
require_once('include/Contact.php'); require_once('include/Contact.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
function follow_content(App &$a) { function follow_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -152,7 +152,7 @@ function follow_content(App &$a) {
return $o; return $o;
} }
function follow_post(App &$a) { function follow_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -1,6 +1,6 @@
<?php <?php
function friendica_init(App &$a) { function friendica_init(App $a) {
if ($a->argv[1]=="json"){ if ($a->argv[1]=="json"){
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
@ -59,7 +59,7 @@ function friendica_init(App &$a) {
function friendica_content(App &$a) { function friendica_content(App $a) {
$o = ''; $o = '';
$o .= '<h3>Friendica</h3>'; $o .= '<h3>Friendica</h3>';

View File

@ -1,7 +1,7 @@
<?php <?php
function fsuggest_post(App &$a) { function fsuggest_post(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -71,7 +71,7 @@ function fsuggest_post(App &$a) {
function fsuggest_content(App &$a) { function fsuggest_content(App $a) {
require_once('include/acl_selectors.php'); require_once('include/acl_selectors.php');

View File

@ -4,7 +4,7 @@ function validate_members(&$item) {
$item = intval($item); $item = intval($item);
} }
function group_init(App &$a) { function group_init(App $a) {
if(local_user()) { if(local_user()) {
require_once('include/group.php'); require_once('include/group.php');
$a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0)); $a->page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0));
@ -13,7 +13,7 @@ function group_init(App &$a) {
function group_post(App &$a) { function group_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -69,7 +69,7 @@ function group_post(App &$a) {
return; return;
} }
function group_content(App &$a) { function group_content(App $a) {
$change = false; $change = false;
if (! local_user()) { if (! local_user()) {

View File

@ -1,6 +1,6 @@
<?php <?php
function hcard_init(App &$a) { function hcard_init(App $a) {
$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false); $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);

View File

@ -18,7 +18,7 @@ if (!function_exists('load_doc_file')) {
} }
function help_content(App &$a) { function help_content(App $a) {
nav_set_selected('help'); nav_set_selected('help');

View File

@ -1,7 +1,7 @@
<?php <?php
if(! function_exists('home_init')) { if(! function_exists('home_init')) {
function home_init(App &$a) { function home_init(App $a) {
$ret = array(); $ret = array();
call_hooks('home_init',$ret); call_hooks('home_init',$ret);
@ -17,7 +17,7 @@ function home_init(App &$a) {
}} }}
if(! function_exists('home_content')) { if(! function_exists('home_content')) {
function home_content(App &$a) { function home_content(App $a) {
$o = ''; $o = '';

View File

@ -2,7 +2,7 @@
require_once('include/crypto.php'); require_once('include/crypto.php');
function hostxrd_init(App &$a) { function hostxrd_init(App $a) {
header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Origin: *');
header("Content-type: text/xml"); header("Content-type: text/xml");
$pubkey = get_config('system','site_pubkey'); $pubkey = get_config('system','site_pubkey');

View File

@ -11,7 +11,7 @@
require_once("include/socgraph.php"); require_once("include/socgraph.php");
require_once("include/Contact.php"); require_once("include/Contact.php");
function hovercard_init(App &$a) { function hovercard_init(App $a) {
// Just for testing purposes // Just for testing purposes
$_GET["mode"] = "minimal"; $_GET["mode"] = "minimal";
} }

View File

@ -1,7 +1,7 @@
<?php <?php
function ignored_init(App &$a) { function ignored_init(App $a) {
$ignored = 0; $ignored = 0;

View File

@ -4,7 +4,7 @@ require_once "include/Photo.php";
$install_wizard_pass=1; $install_wizard_pass=1;
function install_init(App &$a){ function install_init(App $a) {
// $baseurl/install/testrwrite to test if rewite in .htaccess is working // $baseurl/install/testrwrite to test if rewite in .htaccess is working
if ($a->argc==2 && $a->argv[1]=="testrewrite") { if ($a->argc==2 && $a->argv[1]=="testrewrite") {
@ -24,7 +24,7 @@ function install_init(App &$a){
} }
function install_post(App &$a) { function install_post(App $a) {
global $install_wizard_pass, $db; global $install_wizard_pass, $db;
switch($install_wizard_pass) { switch($install_wizard_pass) {
@ -132,7 +132,7 @@ function get_db_errno() {
} }
} }
function install_content(App &$a) { function install_content(App $a) {
global $install_wizard_pass, $db; global $install_wizard_pass, $db;
$o = ''; $o = '';
@ -565,7 +565,7 @@ function check_imagik(&$checks) {
} }
} }
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 = 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 = 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 .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>"; $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";

View File

@ -9,7 +9,7 @@
require_once('include/email.php'); require_once('include/email.php');
function invite_post(App &$a) { function invite_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -97,7 +97,7 @@ function invite_post(App &$a) {
} }
function invite_content(App &$a) { function invite_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -27,7 +27,7 @@ require_once('include/Scrape.php');
require_once('include/diaspora.php'); require_once('include/diaspora.php');
require_once('include/Contact.php'); require_once('include/Contact.php');
function item_post(App &$a) { function item_post(App $a) {
if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter'))) if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter')))
return; return;
@ -1066,7 +1066,7 @@ function item_post_return($baseurl, $api_source, $return_path) {
function item_content(App &$a) { function item_content(App $a) {
if ((! local_user()) && (! remote_user())) { if ((! local_user()) && (! remote_user())) {
return; return;

View File

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
require_once('include/like.php'); require_once('include/like.php');
function like_content(App &$a) { function like_content(App $a) {
if(! local_user() && ! remote_user()) { if(! local_user() && ! remote_user()) {
return false; return false;
} }

View File

@ -3,7 +3,7 @@
require_once('include/datetime.php'); require_once('include/datetime.php');
function localtime_post(App &$a) { function localtime_post(App $a) {
$t = $_REQUEST['time']; $t = $_REQUEST['time'];
if(! $t) if(! $t)
@ -16,7 +16,7 @@ function localtime_post(App &$a) {
} }
function localtime_content(App &$a) { function localtime_content(App $a) {
$t = $_REQUEST['time']; $t = $_REQUEST['time'];
if(! $t) if(! $t)
$t = 'now'; $t = 'now';

View File

@ -1,7 +1,7 @@
<?php <?php
function lockview_content(App &$a) { function lockview_content(App $a) {
$type = (($a->argc > 1) ? $a->argv[1] : 0); $type = (($a->argc > 1) ? $a->argv[1] : 0);
if (is_numeric($type)) { if (is_numeric($type)) {

View File

@ -1,6 +1,6 @@
<?php <?php
function login_content(App &$a) { function login_content(App $a) {
if(x($_SESSION,'theme')) if(x($_SESSION,'theme'))
unset($_SESSION['theme']); unset($_SESSION['theme']);
if(x($_SESSION,'mobile-theme')) if(x($_SESSION,'mobile-theme'))

View File

@ -4,7 +4,7 @@ require_once('include/email.php');
require_once('include/enotify.php'); require_once('include/enotify.php');
require_once('include/text.php'); require_once('include/text.php');
function lostpass_post(App &$a) { function lostpass_post(App $a) {
$loginame = notags(trim($_POST['login-name'])); $loginame = notags(trim($_POST['login-name']));
if(! $loginame) if(! $loginame)
@ -77,7 +77,7 @@ function lostpass_post(App &$a) {
} }
function lostpass_content(App &$a) { function lostpass_content(App $a) {
if(x($_GET,'verify')) { if(x($_GET,'verify')) {

View File

@ -1,6 +1,6 @@
<?php <?php
function maintenance_content(App &$a) { function maintenance_content(App $a) {
header('HTTP/1.1 503 Service Temporarily Unavailable'); header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable'); header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 600'); header('Retry-After: 600');

View File

@ -3,7 +3,7 @@
require_once("include/text.php"); require_once("include/text.php");
function manage_post(App &$a) { function manage_post(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -92,7 +92,7 @@ function manage_post(App &$a) {
function manage_content(App &$a) { function manage_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -10,10 +10,10 @@ require_once('mod/proxy.php');
* It takes keywords from your profile and queries the directory server for * It takes keywords from your profile and queries the directory server for
* matching keywords from other profiles. * matching keywords from other profiles.
* *
* @param App &$a * @param App $a
* @return void|string * @return void|string
*/ */
function match_content(App &$a) { function match_content(App $a) {
$o = ''; $o = '';
if (! local_user()) { if (! local_user()) {

View File

@ -4,7 +4,7 @@ require_once('include/acl_selectors.php');
require_once('include/message.php'); require_once('include/message.php');
require_once('include/Smilies.php'); require_once('include/Smilies.php');
function message_init(App &$a) { function message_init(App $a) {
$tabs = ''; $tabs = '';
@ -40,7 +40,7 @@ function message_init(App &$a) {
} }
function message_post(App &$a) { function message_post(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
@ -173,7 +173,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
function message_content(App &$a) { function message_content(App $a) {
$o = ''; $o = '';
nav_set_selected('messages'); nav_set_selected('messages');

View File

@ -2,7 +2,7 @@
require_once('library/asn1.php'); require_once('library/asn1.php');
function modexp_init(App &$a) { function modexp_init(App $a) {
if($a->argc != 2) if($a->argc != 2)
killme(); killme();

View File

@ -5,7 +5,7 @@ require_once('include/bbcode.php');
require_once('include/items.php'); require_once('include/items.php');
function mood_init(App &$a) { function mood_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -109,7 +109,7 @@ function mood_init(App &$a) {
function mood_content(App &$a) { function mood_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -1,6 +1,6 @@
<?php <?php
function msearch_post(App &$a) { function msearch_post(App $a) {
$perpage = (($_POST['n']) ? $_POST['n'] : 80); $perpage = (($_POST['n']) ? $_POST['n'] : 80);
$page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0); $page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0);

View File

@ -2,7 +2,7 @@
require_once("include/nav.php"); require_once("include/nav.php");
function navigation_content(App &$a) { function navigation_content(App $a) {
$nav_info = nav_info($a); $nav_info = nav_info($a);

View File

@ -1,5 +1,5 @@
<?php <?php
function network_init(App &$a) { function network_init(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);
return; return;
@ -221,7 +221,7 @@ function saved_searches($search) {
* *
* @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active ); * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active );
*/ */
function network_query_get_sel_tab(App &$a) { function network_query_get_sel_tab(App $a) {
$no_active=''; $no_active='';
$starred_active = ''; $starred_active = '';
$new_active = ''; $new_active = '';
@ -292,7 +292,7 @@ function network_query_get_sel_net() {
return $network; return $network;
} }
function network_query_get_sel_group(App &$a) { function network_query_get_sel_group(App $a) {
$group = false; $group = false;
if($a->argc >= 2 && is_numeric($a->argv[1])) { if($a->argc >= 2 && is_numeric($a->argv[1])) {
@ -303,7 +303,7 @@ function network_query_get_sel_group(App &$a) {
} }
function network_content(&$a, $update = 0) { function network_content(App $a, $update = 0) {
require_once('include/conversation.php'); require_once('include/conversation.php');
@ -809,7 +809,7 @@ function network_content(&$a, $update = 0) {
* @param app $a The global App * @param app $a The global App
* @return string Html of the networktab * @return string Html of the networktab
*/ */
function network_tabs(App &$a) { function network_tabs(App $a) {
// item filter tabs // item filter tabs
/// @TODO fix this logic, reduce duplication /// @TODO fix this logic, reduce duplication
/// $a->page['content'] .= '<div class="tabs-wrapper">'; /// $a->page['content'] .= '<div class="tabs-wrapper">';

View File

@ -1,6 +1,6 @@
<?php <?php
function newmember_content(App &$a) { function newmember_content(App $a) {
$o = '<h1>' . t('Welcome to Friendica') . '</h1>'; $o = '<h1>' . t('Welcome to Friendica') . '</h1>';

View File

@ -7,7 +7,7 @@
require_once("include/plugin.php"); require_once("include/plugin.php");
function nodeinfo_wellknown(App &$a) { function nodeinfo_wellknown(App $a) {
if (!get_config("system", "nodeinfo")) { if (!get_config("system", "nodeinfo")) {
http_status_exit(404); http_status_exit(404);
killme(); killme();
@ -20,7 +20,7 @@ function nodeinfo_wellknown(App &$a) {
exit; exit;
} }
function nodeinfo_init(App &$a){ function nodeinfo_init(App $a) {
if (!get_config("system", "nodeinfo")) { if (!get_config("system", "nodeinfo")) {
http_status_exit(404); http_status_exit(404);
killme(); killme();

View File

@ -4,7 +4,7 @@ require_once('include/Contact.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/contact_selectors.php'); require_once('include/contact_selectors.php');
function nogroup_init(App &$a) { function nogroup_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -21,7 +21,7 @@ function nogroup_init(App &$a) {
} }
function nogroup_content(App &$a) { function nogroup_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -1,6 +1,6 @@
<?php <?php
function noscrape_init(App &$a) { function noscrape_init(App $a) {
if($a->argc > 1) if($a->argc > 1)
$which = $a->argv[1]; $which = $a->argv[1];

View File

@ -1,6 +1,6 @@
<?php <?php
function notes_init(App &$a) { function notes_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
@ -17,7 +17,7 @@ function notes_init(App &$a) {
} }
function notes_content(&$a,$update = false) { function notes_content(App $a, $update = false) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -1,7 +1,7 @@
<?php <?php
/* identi.ca -> friendica items permanent-url compatibility */ /* identi.ca -> friendica items permanent-url compatibility */
function notice_init(App &$a){ function notice_init(App $a) {
$id = $a->argv[1]; $id = $a->argv[1];
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d", $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id) intval($id)

View File

@ -9,7 +9,7 @@ require_once("include/NotificationsManager.php");
require_once("include/contact_selectors.php"); require_once("include/contact_selectors.php");
require_once("include/network.php"); require_once("include/network.php");
function notifications_post(App &$a) { function notifications_post(App $a) {
if (! local_user()) { if (! local_user()) {
goaway(z_root()); goaway(z_root());
@ -65,7 +65,7 @@ function notifications_post(App &$a) {
} }
} }
function notifications_content(App &$a) { function notifications_content(App $a) {
if (! local_user()) { if (! local_user()) {
notice( t('Permission denied.') . EOL); notice( t('Permission denied.') . EOL);

View File

@ -1,7 +1,7 @@
<?php <?php
require_once('include/NotificationsManager.php'); require_once('include/NotificationsManager.php');
function notify_init(App &$a) { function notify_init(App $a) {
if (! local_user()) { if (! local_user()) {
return; return;
} }
@ -39,7 +39,7 @@ function notify_init(App &$a) {
} }
function notify_content(App &$a) { function notify_content(App $a) {
if (! local_user()) { if (! local_user()) {
return login(); return login();
} }

View File

@ -1,7 +1,7 @@
<?php <?php
require_once("include/oembed.php"); require_once("include/oembed.php");
function oembed_content(App &$a){ function oembed_content(App $a) {
// logger('mod_oembed ' . $a->query_string, LOGGER_ALL); // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
if ($a->argv[1]=='b2h'){ if ($a->argv[1]=='b2h'){

View File

@ -1,7 +1,7 @@
<?php <?php
function oexchange_init(App &$a) { function oexchange_init(App $a) {
if(($a->argc > 1) && ($a->argv[1] === 'xrd')) { if(($a->argc > 1) && ($a->argv[1] === 'xrd')) {
$tpl = get_markup_template('oexchange_xrd.tpl'); $tpl = get_markup_template('oexchange_xrd.tpl');
@ -14,7 +14,7 @@ function oexchange_init(App &$a) {
} }
function oexchange_content(App &$a) { function oexchange_content(App $a) {
if (! local_user()) { if (! local_user()) {
$o = login(false); $o = login(false);

View File

@ -4,7 +4,7 @@
require_once('library/openid.php'); require_once('library/openid.php');
function openid_content(App &$a) { function openid_content(App $a) {
$noid = get_config('system','no_openid'); $noid = get_config('system','no_openid');
if($noid) if($noid)

Some files were not shown because too many files have changed in this diff Show More