]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #3078 from Hypolite/issue/#3039-mod-2of3
authorMichael Vogel <icarus@dabo.de>
Wed, 11 Jan 2017 21:49:01 +0000 (22:49 +0100)
committerGitHub <noreply@github.com>
Wed, 11 Jan 2017 21:49:01 +0000 (22:49 +0100)
Normalize App parameter declaration (mod folder, 2 out of 3)

125 files changed:
LICENSE
boot.php
database.sql
doc/Plugins.md
doc/autoloader.md
doc/de/Plugins.md
doc/htconfig.md
doc/themes.md
include/Contact.php
include/Photo.php
include/acl_selectors.php
include/api.php
include/conversation.php
include/cron.php
include/dbclean.php
include/dbstructure.php
include/diaspora.php
include/enotify.php
include/event.php
include/identity.php
include/nav.php
include/ostatus.php
include/photos.php
include/plaintext.php
include/redir.php
include/security.php
include/text.php
include/uimport.php
mod/_well_known.php
mod/acctlink.php
mod/acl.php
mod/admin.php
mod/allfriends.php
mod/amcd.php
mod/api.php
mod/apps.php
mod/attach.php
mod/babel.php
mod/bookmarklet.php
mod/cal.php
mod/cb.php
mod/common.php
mod/community.php
mod/contactgroup.php
mod/contacts.php
mod/content.php
mod/credits.php
mod/crepair.php
mod/delegate.php
mod/dfrn_confirm.php
mod/dfrn_notify.php
mod/dfrn_poll.php
mod/dfrn_request.php
mod/directory.php
mod/dirfind.php
mod/display.php
mod/editpost.php
mod/events.php
mod/fbrowser.php
mod/fetch.php
mod/filer.php
mod/filerm.php
mod/follow.php
mod/friendica.php
mod/fsuggest.php
mod/group.php
mod/hcard.php
mod/help.php
mod/home.php
mod/hostxrd.php
mod/photos.php
mod/profiles.php
mod/profperm.php
mod/pubsub.php
mod/pubsubhubbub.php
mod/qsearch.php
mod/randprof.php
mod/receive.php
mod/redir.php
mod/register.php
mod/regmod.php
mod/removeme.php
mod/repair_ostatus.php
mod/rsd_xml.php
mod/salmon.php
mod/search.php
mod/session.php
mod/settings.php
mod/share.php
mod/smilies.php
mod/starred.php
mod/statistics_json.php
mod/subthread.php
mod/suggest.php
mod/tagger.php
mod/tagrm.php
mod/toggle_mobile.php
mod/uexport.php
mod/uimport.php
mod/update_community.php
mod/update_display.php
mod/update_network.php
mod/update_notes.php
mod/update_profile.php
mod/videos.php
mod/viewcontacts.php
mod/viewsrc.php
mod/wall_attach.php
mod/wall_upload.php
mod/wallmessage.php
mod/webfinger.php
mod/xrd.php
update.php
view/theme/duepuntozero/config.php
view/theme/duepuntozero/theme.php
view/theme/frio/config.php
view/theme/frio/php/frio_boot.php
view/theme/frio/theme.php
view/theme/frost-mobile/theme.php
view/theme/frost/theme.php
view/theme/quattro/config.php
view/theme/quattro/theme.php
view/theme/smoothly/theme.php
view/theme/vier/config.php
view/theme/vier/theme.php

diff --git a/LICENSE b/LICENSE
index c155965f819fc6e4b6226b3f5d67a3320433a8ae..2bbe2d1de7dfd041d9123e361b7fc178b0447b03 100644 (file)
--- a/LICENSE
+++ b/LICENSE
@@ -1,5 +1,5 @@
 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
     it under the terms of the GNU Affero General Public License as published by
index dd816270c76e1fc941989666669172a61e33a323..cd6db384a2486a3ff78643b90486694713657ec3 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Asparagus');
 define ( 'FRIENDICA_VERSION',      '3.5.1-dev' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1211      );
+define ( 'DB_UPDATE_VERSION',      1212      );
 
 /**
  * @brief Constant with a HTML line break.
@@ -1540,7 +1540,7 @@ function check_db() {
  * Sets the base url for use in cmdline programs which don't have
  * $_SERVER variables
  */
-function check_url(App &$a) {
+function check_url(App $a) {
 
        $url = get_config('system','url');
 
@@ -1562,7 +1562,7 @@ function check_url(App &$a) {
 /**
  * @brief Automatic database updates
  */
-function update_db(App &$a) {
+function update_db(App $a) {
        $build = get_config('system','build');
        if(! x($build))
                $build = set_config('system','build',DB_UPDATE_VERSION);
@@ -1678,7 +1678,7 @@ function run_update_function($x) {
  * @param App $a
  *
         */
-function check_plugins(App &$a) {
+function check_plugins(App $a) {
 
        $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
        if (dbm::is_result($r))
@@ -2414,7 +2414,7 @@ function get_temppath() {
 }
 
 /// @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
 /// to avoid breaking themes again unnecessarily
 
index 2e83c33a643dea97b59026a69929df8d2727903f..becd14fc7362f3327c524f7c18def356f8a85235 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- 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,
        `ffi_keyword_blacklist` mediumtext,
         PRIMARY KEY(`id`),
-        INDEX `uid` (`uid`),
-        INDEX `addr_uid` (`addr`,`uid`),
-        INDEX `nurl` (`nurl`)
+        INDEX `uid_name` (`uid`,`name`),
+        INDEX `uid_self` (`uid`,`self`),
+        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;
 
 --
@@ -232,7 +239,7 @@ CREATE TABLE IF NOT EXISTS `event` (
        `deny_cid` mediumtext,
        `deny_gid` mediumtext,
         PRIMARY KEY(`id`),
-        INDEX `uid` (`uid`)
+        INDEX `uid_start` (`uid`,`start`)
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -257,7 +264,7 @@ CREATE TABLE IF NOT EXISTS `fcontact` (
        `pubkey` text,
        `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
         PRIMARY KEY(`id`),
-        INDEX `addr` (`addr`)
+        INDEX `addr` (`addr`(32))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -280,7 +287,7 @@ CREATE TABLE IF NOT EXISTS `fserver` (
        `posturl` varchar(255) NOT NULL DEFAULT '',
        `key` text,
         PRIMARY KEY(`id`),
-        INDEX `server` (`server`)
+        INDEX `server` (`server`(32))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -342,10 +349,10 @@ CREATE TABLE IF NOT EXISTS `gcontact` (
        `generation` tinyint(3) NOT NULL DEFAULT 0,
        `server_url` varchar(255) NOT NULL DEFAULT '',
         PRIMARY KEY(`id`),
-        INDEX `nurl` (`nurl`),
-        INDEX `name` (`name`),
-        INDEX `nick` (`nick`),
-        INDEX `addr` (`addr`),
+        INDEX `nurl` (`nurl`(32)),
+        INDEX `name` (`name`(32)),
+        INDEX `nick` (`nick`(32)),
+        INDEX `addr` (`addr`(32)),
         INDEX `updated` (`updated`)
 ) DEFAULT CHARSET=utf8mb4;
 
@@ -360,7 +367,7 @@ CREATE TABLE IF NOT EXISTS `glink` (
        `zcid` int(11) NOT NULL DEFAULT 0,
        `updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
         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 `zcid` (`zcid`)
 ) DEFAULT CHARSET=utf8mb4;
@@ -387,7 +394,9 @@ CREATE TABLE IF NOT EXISTS `group_member` (
        `gid` int(10) unsigned NOT NULL DEFAULT 0,
        `contact-id` int(10) unsigned NOT NULL DEFAULT 0,
         PRIMARY KEY(`id`),
-        INDEX `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;
 
 --
@@ -410,7 +419,7 @@ CREATE TABLE IF NOT EXISTS `gserver` (
        `last_contact` datetime DEFAULT '0000-00-00 00:00:00',
        `last_failure` datetime DEFAULT '0000-00-00 00:00:00',
         PRIMARY KEY(`id`),
-        INDEX `nurl` (`nurl`)
+        INDEX `nurl` (`nurl`(32))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -525,24 +534,17 @@ CREATE TABLE IF NOT EXISTS `item` (
         INDEX `uid_network_received` (`uid`,`network`,`received`),
         INDEX `uid_received` (`uid`,`received`),
         INDEX `uid_network_commented` (`uid`,`network`,`commented`),
-        INDEX `uid_commented` (`uid`,`commented`),
         INDEX `uid_title` (`uid`,`title`),
         INDEX `uid_thrparent` (`uid`,`thr-parent`),
         INDEX `uid_parenturi` (`uid`,`parent-uri`),
         INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
         INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
-        INDEX `gcontactid_uid_created` (`gcontact-id`,`uid`,`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_wall_created` (`uid`,`wall`,`created`),
         INDEX `resource-id` (`resource-id`),
         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 `uid_wall_parent_created` (`uid`,`wall`,`parent`,`created`),
         INDEX `uid_type_changed` (`uid`,`type`,`changed`),
         INDEX `contactid_verb` (`contact-id`,`verb`),
         INDEX `deleted_changed` (`deleted`,`changed`),
@@ -564,7 +566,7 @@ CREATE TABLE IF NOT EXISTS `item_id` (
         PRIMARY KEY(`id`),
         INDEX `uid` (`uid`),
         INDEX `sid` (`sid`),
-        INDEX `service` (`service`),
+        INDEX `service` (`service`(32)),
         INDEX `iid` (`iid`)
 ) DEFAULT CHARSET=utf8mb4;
 
@@ -602,11 +604,10 @@ CREATE TABLE IF NOT EXISTS `mail` (
        `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
         PRIMARY KEY(`id`),
         INDEX `uid` (`uid`),
-        INDEX `guid` (`guid`),
+        INDEX `uid_seen` (`uid`,`seen`),
         INDEX `convid` (`convid`),
-        INDEX `reply` (`reply`),
-        INDEX `uri` (`uri`),
-        INDEX `parent-uri` (`parent-uri`)
+        INDEX `uri` (`uri`(64)),
+        INDEX `parent-uri` (`parent-uri`(64))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -662,7 +663,11 @@ CREATE TABLE IF NOT EXISTS `notify` (
        `name_cache` tinytext,
        `msg_cache` mediumtext,
         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;
 
 --
@@ -675,8 +680,7 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
        `parent-item` int(10) unsigned NOT NULL DEFAULT 0,
        `receiver-uid` int(11) NOT NULL DEFAULT 0,
         PRIMARY KEY(`id`),
-        INDEX `master-parent-item` (`master-parent-item`),
-        INDEX `receiver-uid` (`receiver-uid`)
+        INDEX `master-parent-item` (`master-parent-item`)
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -745,9 +749,9 @@ CREATE TABLE IF NOT EXISTS `photo` (
         PRIMARY KEY(`id`),
         INDEX `uid_contactid` (`uid`,`contact-id`),
         INDEX `uid_profile` (`uid`,`profile`),
-        INDEX `uid_album_created` (`uid`,`album`,`created`),
-        INDEX `resource-id` (`resource-id`),
-        INDEX `guid` (`guid`)
+        INDEX `uid_album_created` (`uid`,`album`(32),`created`),
+        INDEX `uid_album_resource-id_created` (`uid`,`album`(32),`resource-id`(64),`created`),
+        INDEX `resource-id` (`resource-id`(64))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -839,8 +843,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
        `thumb` varchar(255) NOT NULL DEFAULT '',
        `publish` tinyint(1) NOT NULL DEFAULT 0,
        `net-publish` tinyint(1) NOT NULL DEFAULT 0,
-        PRIMARY KEY(`id`),
-        INDEX `hometown` (`hometown`)
+        PRIMARY KEY(`id`)
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -912,8 +915,7 @@ CREATE TABLE IF NOT EXISTS `search` (
        `uid` int(11) NOT NULL DEFAULT 0,
        `term` varchar(255) NOT NULL DEFAULT '',
         PRIMARY KEY(`id`),
-        INDEX `uid` (`uid`),
-        INDEX `term` (`term`)
+        INDEX `uid` (`uid`)
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -925,7 +927,7 @@ CREATE TABLE IF NOT EXISTS `session` (
        `data` text,
        `expire` int(10) unsigned NOT NULL DEFAULT 0,
         PRIMARY KEY(`id`),
-        INDEX `sid` (`sid`),
+        INDEX `sid` (`sid`(64)),
         INDEX `expire` (`expire`)
 ) DEFAULT CHARSET=utf8mb4;
 
@@ -977,12 +979,11 @@ CREATE TABLE IF NOT EXISTS `term` (
        `uid` int(10) unsigned NOT NULL DEFAULT 0,
         PRIMARY KEY(`tid`),
         INDEX `oid_otype_type_term` (`oid`,`otype`,`type`,`term`),
-        INDEX `uid_term_tid` (`uid`,`term`,`tid`),
-        INDEX `type_term` (`type`,`term`),
-        INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`,`global`,`created`),
-        INDEX `otype_type_term_tid` (`otype`,`type`,`term`,`tid`),
-        INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`),
-        INDEX `guid` (`guid`)
+        INDEX `uid_term_tid` (`uid`,`term`(32),`tid`),
+        INDEX `type_term` (`type`,`term`(32)),
+        INDEX `uid_otype_type_term_global_created` (`uid`,`otype`,`type`,`term`(32),`global`,`created`),
+        INDEX `uid_otype_type_url` (`uid`,`otype`,`type`,`url`(64)),
+        INDEX `guid` (`guid`(64))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -1022,9 +1023,6 @@ CREATE TABLE IF NOT EXISTS `thread` (
         INDEX `uid_network_created` (`uid`,`network`,`created`),
         INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
         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_commented` (`uid`,`commented`)
 ) DEFAULT CHARSET=utf8mb4;
@@ -1090,7 +1088,7 @@ CREATE TABLE IF NOT EXISTS `user` (
        `deny_gid` mediumtext,
        `openidserver` text,
         PRIMARY KEY(`uid`),
-        INDEX `nickname` (`nickname`)
+        INDEX `nickname` (`nickname`(32))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
@@ -1100,7 +1098,7 @@ CREATE TABLE IF NOT EXISTS `userd` (
        `id` int(11) NOT NULL auto_increment,
        `username` varchar(255) NOT NULL,
         PRIMARY KEY(`id`),
-        INDEX `username` (`username`)
+        INDEX `username` (`username`(32))
 ) DEFAULT CHARSET=utf8mb4;
 
 --
index 6460fd5a09459bf6fe57f3dcf1fab6403de1b2de..3a25dc72170184013197a5bee99498c8e12c3fdd 100644 (file)
@@ -40,7 +40,7 @@ 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->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.
-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.
+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.
+You may also have plugin_name_init(App $a) which is called very early on and often does module initialisation.
 
 Templates
 ---
@@ -285,7 +285,7 @@ $b is an array with:
 is called after the other queries have passed.
 The registered function can add, change or remove the acl_lookup() variables.
 
-    'results' => array of the acl_lookup() vars 
+    'results' => array of the acl_lookup() vars
 
 
 Complete list of hook callbacks
index 25ffd7fe45b77fe36f3f0693e1ac6ffefcacf4ad..69c62451cd9453f04dc9dbc0ec04aaa2924d2550 100644 (file)
@@ -32,7 +32,7 @@ Let's say you have a php file in "include/" that define a very useful class:
     file: include/ItemsManager.php\r
     <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class ItemsManager {\r
        public function getAll() { ... }\r
        public function getByID($id) { ... }\r
@@ -67,11 +67,11 @@ The code will be something like:
 ```\r
     file: mod/network.php\r
     <?php\r
-    \r
-    function network_content(App &$a) {\r
+\r
+    function network_content(App $a) {\r
        $itemsmanager = new \Friendica\ItemsManager();\r
        $items = $itemsmanager->getAll();\r
-    \r
+\r
        // pass $items to template\r
        // return result\r
     }\r
@@ -86,7 +86,7 @@ Going further: now we have a bunch of "*Manager" classes that cause some code du
     file: include/BaseManager.php\r
     <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class BaseManager {\r
       public function thatFunctionEveryManagerUses() { ... }\r
     }\r
@@ -98,7 +98,7 @@ and then let's change the ItemsManager class to use this code
     file: include/ItemsManager.php\r
     <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class ItemsManager extends BaseManager {\r
        public function getAll() { ... }\r
        public function getByID($id) { ... }\r
@@ -110,9 +110,9 @@ It works with the "BaseManager" example here, it works when we need to call stat
 \r
 ```\r
     file: include/dfrn.php\r
-    <?php    \r
+    <?php\r
     namespace \Friendica;\r
-    \r
+\r
     class dfrn {\r
       public static function  mail($item, $owner) { ... }\r
     }\r
@@ -121,7 +121,7 @@ It works with the "BaseManager" example here, it works when we need to call stat
 ```\r
     file: mod/mail.php\r
     <?php\r
-    \r
+\r
     mail_post($a){\r
      ...\r
      \Friendica\dfrn::mail($item, $owner);\r
@@ -134,15 +134,15 @@ If your code is in same namespace as the class you need, you don't need to prepe
 ```\r
     file: include/delivery.php\r
     <?php\r
-    \r
+\r
     namespace \Friendica;\r
-    \r
-    // this is the same content of current include/delivery.php, \r
+\r
+    // this is the same content of current include/delivery.php,\r
     // but has been declared to be in "Friendica" namespace\r
-    \r
+\r
     [...]\r
     switch($contact['network']) {\r
-    \r
+\r
         case NETWORK_DFRN:\r
             if ($mail) {\r
                 $item['body'] = ...\r
@@ -160,11 +160,11 @@ But if you want to use classes from another library, you need to use the full na
 \r
 ```\r
     <?php\r
-    namespace \Frienidca;\r
-    \r
+    namespace \Friendica;\r
+\r
     class Diaspora {\r
       public function md2bbcode() {\r
-        $html = \Michelf\MarkdownExtra::defaultTransform($text); \r
+        $html = \Michelf\MarkdownExtra::defaultTransform($text);\r
       }\r
     }\r
 ```\r
@@ -173,13 +173,13 @@ if you use that class in many places of the code and you don't want to write the
 \r
 ```\r
     <?php\r
-    namespace \Frienidca;\r
-    \r
+    namespace \Friendica;\r
+\r
     use \Michelf\MarkdownExtra;\r
-    \r
+\r
     class Diaspora {\r
       public function md2bbcode() {\r
-        $html = MarkdownExtra::defaultTransform($text); \r
+        $html = MarkdownExtra::defaultTransform($text);\r
       }\r
     }\r
 ```\r
@@ -190,7 +190,7 @@ You can go more deep if you want to, like:
 ```\r
     <?php\r
     namespace \Friendica\Network;\r
-    \r
+\r
     class DFRN {\r
     }\r
 ```\r
@@ -200,7 +200,7 @@ or
 ```\r
     <?php\r
     namespace \Friendica\DBA;\r
-    \r
+\r
     class MySQL {\r
     }\r
 ```\r
index b2c3f849ffae55ae57ee7fcdc72dca9ed0024dbf..8b1c71177d308770621ce26652609311b3925b0c 100644 (file)
@@ -40,7 +40,7 @@ Argumente
 
 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->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.
-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.
+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.
+Du kannst ebenso plugin_name_init(App $a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
 
 
 Derzeitige Hooks
@@ -311,7 +311,7 @@ mod/photos.php:                     call_hooks('photo_post_end',intval($item_id));
 
 mod/photos.php:                        call_hooks('photo_upload_form',$ret);
 
-mod/friendica.php:             call_hooks('about_hook', $o);   
+mod/friendica.php:             call_hooks('about_hook', $o);
 
 mod/editpost.php:              call_hooks('jot_tool', $jotplugins);
 
index fb257c3dacfaf4d19a761b53af164af7233d7b91..05a2a7a963aa87ee10baf338d376bc1d1ad9ea33 100644 (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.
 * **birthday_input_format** - Default value is "ymd".
 * **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** -
 * **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.
@@ -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.
 * **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_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_rich_content** (Boolean) - Don't show the rich content (e.g. embedded PDF).
 * **no_smilies** (Boolean) - Don't show smilies.
index 0b8f6cb83dc03aefd95a860b61609488a821c276..b553debfd756102942eace6786202f7721ba5a81 100644 (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.
 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
         if (! local_user()) {
             return;
@@ -168,7 +168,7 @@ The content of this file should be something like
 
     <?php
     /* meta informations for the theme, see below */
-    function duepuntozero_lr_init(App &$a) {
+    function duepuntozero_lr_init(App $a) {
         $a-> theme_info = array(
             '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.
 So in the case of quattro it is
 
-    function quattro_init(App &$a) {
+    function quattro_init(App $a) {
       $a->theme_info = array();
       set_template_engine($a, 'smarty3');
     }
index 5d8ccc4529d6e4c4423e56a0e2b83a60e541b260..15b6813714f2bff59863bb98256c4c39def94956 100644 (file)
@@ -612,7 +612,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
  *
  * @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');
 
@@ -636,7 +636,7 @@ function posts_from_gcontact($a, $gcontact_id) {
        $r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
                        `author-name` AS `name`, `owner-avatar` AS `photo`,
                        `owner-link` AS `url`, `owner-avatar` AS `thumb`
-               FROM `item` FORCE INDEX (`gcontactid_uid_created`)
+               FROM `item`
                WHERE `gcontact-id` = %d AND $sql AND
                        NOT `deleted` AND NOT `moderated` AND `visible`
                ORDER BY `item`.`created` DESC LIMIT %d, %d",
@@ -664,7 +664,7 @@ function posts_from_gcontact($a, $gcontact_id) {
  *
  * @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');
 
index 1a97fe2fe47b1d31f95ae0abc2acd5fafcc5c918..828dce82d7a33088c4bae02e1c350104a6e58114 100644 (file)
@@ -283,7 +283,7 @@ class Photo {
                        do {
 
                                // FIXME - implement horizantal bias for scaling as in followin GD functions
-                               // to allow very tall images to be constrained only horizontally. 
+                               // to allow very tall images to be constrained only horizontally.
 
                                $this->image->scaleImage($dest_width, $dest_height);
                        } while ($this->image->nextImage());
@@ -943,7 +943,7 @@ function scale_image($width, $height, $max) {
        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`
                WHERE `user`.`uid` = %d AND `user`.`blocked` = 0 AND `contact`.`self` = 1 LIMIT 1",
                intval($uid));
index f6c4f947edc4ff5e724fbda2d38da9beb6a7b09c..fccdb80665974f98df95047592697052c5ecd222 100644 (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";
 
        $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
                ORDER BY `name` ASC ",
                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";
 
        $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
                ORDER BY `name` ASC ",
                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
        $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()) {
                return '';
@@ -449,8 +449,8 @@ function acl_lookup(&$a, $out_type = 'json') {
        // autocomplete for editor mentions
        if ($type=='' || $type=='c'){
                $r = q("SELECT COUNT(*) AS c 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 `notify` != '' $sql_extra2" ,
                        intval(local_user())
                );
@@ -461,8 +461,8 @@ function acl_lookup(&$a, $out_type = 'json') {
                // autocomplete for Private Messages
 
                $r = q("SELECT COUNT(*) AS c 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') $sql_extra2" ,
                        intval(local_user()),
                        dbesc(NETWORK_DFRN),
@@ -477,8 +477,8 @@ function acl_lookup(&$a, $out_type = 'json') {
                // autocomplete for Contacts
 
                $r = q("SELECT COUNT(*) AS c FROM `contact`
-                               WHERE `uid` = %d AND `self` = 0
-                               AND `pending` = 0 $sql_extra2" ,
+                               WHERE `uid` = %d AND NOT `self`
+                               AND NOT `pending` $sql_extra2" ,
                        intval(local_user())
                );
                $contact_count = (int)$r[0]['c'];
@@ -525,7 +525,7 @@ function acl_lookup(&$a, $out_type = 'json') {
        if ($type==''){
 
                $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'))
                        $sql_extra2
                        ORDER BY `name` ASC ",
@@ -536,7 +536,7 @@ function acl_lookup(&$a, $out_type = 'json') {
        elseif ($type=='c'){
 
                $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'))
                        $sql_extra2
                        ORDER BY `name` ASC ",
@@ -546,7 +546,7 @@ function acl_lookup(&$a, $out_type = 'json') {
        }
        elseif($type == 'm') {
                $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')
                        $sql_extra2
                        ORDER BY `name` ASC ",
@@ -687,11 +687,11 @@ function acl_lookup(&$a, $out_type = 'json') {
 }
 /**
  * @brief Searching for global contacts for autocompletion
- * 
+ *
  * @param App $a
  * @return array with the search results
  */
-function navbar_complete(App &$a) {
+function navbar_complete(App $a) {
 
 //     logger('navbar_complete');
 
index 3543a38362d995a38dabcab6c86f72e15b60b26d..91a3a34d110f20a926b780bd3db3a7d0cd25fa14 100644 (file)
         * @hook 'logged_in'
         *              array $user     logged user record
         */
-       function api_login(App &$a){
+       function api_login(App $a){
                // login with oauth
                try{
                        $oauth = new FKOAuth1();
         * @param App $a
         * @return string API call result
         */
-       function api_call(App &$a){
+       function api_call(App $a){
                global $API, $called_api;
 
                $type="json";
         * @param array $user_info
         * @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);
                $arr['$user'] = $user_info;
                $arr['$rss'] = array(
         * @param int|string $contact_id Contact ID or URL
         * @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;
                $user = null;
                $extra_query = "";
         * @param array $item : item from db
         * @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"]);
 
                                                        'homepage' => $profile['homepage'],
                                                        'users' => null);
                        return $profile;
-               } 
+               }
        }
 
        /**
                // BadRequestException if no id specified (for clients using Twitter API)
                if ($id == 0) throw new BadRequestException('Message id not specified');
 
-               // add parent-uri to sql command if specified by calling app            
+               // add parent-uri to sql command if specified by calling app
                $sql_extra = ($parenturi != "" ? " AND `parent-uri` = '" . dbesc($parenturi) . "'" : "");
 
                // get data of the specified message id
                $r = q("SELECT `id` FROM `mail` WHERE `uid` = %d AND `id` = %d" . $sql_extra,
-                       intval($uid), 
+                       intval($uid),
                        intval($id));
-       
+
                // error message if specified id is not in database
                if (!dbm::is_result($r)) {
                        if ($verbose == "true") {
                }
 
                // delete message
-               $result = q("DELETE FROM `mail` WHERE `uid` = %d AND `id` = %d" . $sql_extra, 
-                       intval($uid), 
+               $result = q("DELETE FROM `mail` WHERE `uid` = %d AND `id` = %d" . $sql_extra,
+                       intval($uid),
                        intval($id));
 
                if ($verbose == "true") {
 
                // get data of the specified message id
                $r = q("SELECT `id` FROM `mail` WHERE `id` = %d AND `uid` = %d",
-                       intval($id), 
+                       intval($id),
                        intval($uid));
                // error message if specified id is not in database
                if (!dbm::is_result($r)) {
                }
 
                // update seen indicator
-               $result = q("UPDATE `mail` SET `seen` = 1 WHERE `id` = %d AND `uid` = %d", 
-                       intval($id), 
+               $result = q("UPDATE `mail` SET `seen` = 1 WHERE `id` = %d AND `uid` = %d",
+                       intval($id),
                        intval($uid));
 
                if ($result) {
                // message if nothing was found
                if (!dbm::is_result($r))
                        $success = array('success' => false, 'search_results' => 'problem with query');
-               else if (count($r) == 0) 
+               else if (count($r) == 0)
                        $success = array('success' => false, 'search_results' => 'nothing found');
                else {
                        $ret = Array();
index 36eded8e8afe1b54ca69b949a6f7228f04adfb24..571e2facedfb1a89b0a803bf7bb4ff9b08e0552e 100644 (file)
@@ -466,7 +466,7 @@ function item_condition() {
  */
 
 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/Contact.php');
index e98239b82931aa4a74f56904037843c1385f1102..5a9054b11b78be6920f808f29c88a33af8ab7940 100644 (file)
@@ -128,7 +128,7 @@ function cron_run(&$argv, &$argc){
 
                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();
        }
@@ -343,7 +343,7 @@ function cron_poll_contacts($argc, $argv) {
  *
  * @param App $a
  */
-function cron_clear_cache(App &$a) {
+function cron_clear_cache(App $a) {
 
        $last = get_config('system','cache_last_cleared');
 
@@ -430,7 +430,7 @@ function cron_clear_cache(App &$a) {
  *
  * @param App $a
  */
-function cron_repair_diaspora(App &$a) {
+function cron_repair_diaspora(App $a) {
        $r = q("SELECT `id`, `url` FROM `contact`
                WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
                        ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
index 0baece81685678fa7bcbff4978ad1eaafed21704..c80e5a3be357f2c26d997a0827d554b15f976fb7 100644 (file)
@@ -3,13 +3,18 @@
  * @file include/dbclean.php
  * @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");
 
 function dbclean_run(&$argv, &$argc) {
        global $a, $db;
 
-       if (is_null($a))
+       if (is_null($a)) {
                $a = new App;
+       }
 
        if (is_null($db)) {
                @include(".htconfig.php");
@@ -18,8 +23,12 @@ function dbclean_run(&$argv, &$argc) {
                unset($db_host, $db_user, $db_pass, $db_data);
        }
 
-       load_config('config');
-       load_config('system');
+       Config::load('config');
+       Config::load('system');
+
+       if (!Config::get('system', 'dbclean', false)) {
+               return;
+       }
 
        if ($argc == 2) {
                $stage = intval($argv[1]);
@@ -27,7 +36,7 @@ function dbclean_run(&$argv, &$argc) {
                $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', 2);
                proc_run(PRIORITY_LOW, 'include/dbclean.php', 3);
@@ -48,11 +57,18 @@ function remove_orphans($stage = 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)) {
                logger("Deleting old global item entries from item table without user copy");
                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 `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY LIMIT 10000", true)) {
+                               AND `received` < UTC_TIMESTAMP() - INTERVAL 90 DAY LIMIT ".intval($limit), true)) {
                        $count = $db->num_rows();
                        logger("found global item orphans: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -65,7 +81,7 @@ function remove_orphans($stage = 0) {
 
        if (($stage == 2) OR ($stage == 0)) {
                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();
                        logger("found item orphans without parents: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -78,7 +94,7 @@ function remove_orphans($stage = 0) {
 
        if (($stage == 3) OR ($stage == 0)) {
                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();
                        logger("found thread orphans: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -91,7 +107,7 @@ function remove_orphans($stage = 0) {
 
        if (($stage == 4) OR ($stage == 0)) {
                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();
                        logger("found notify orphans: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -104,7 +120,7 @@ function remove_orphans($stage = 0) {
 
        if (($stage == 5) OR ($stage == 0)) {
                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();
                        logger("found notify-threads orphans: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -118,7 +134,7 @@ function remove_orphans($stage = 0) {
 
        if (($stage == 6) OR ($stage == 0)) {
                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();
                        logger("found sign orphans: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -132,7 +148,7 @@ function remove_orphans($stage = 0) {
 
        if (($stage == 7) OR ($stage == 0)) {
                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();
                        logger("found term orphans: ".$count);
                        while ($orphan = $db->qfetch()) {
@@ -144,8 +160,8 @@ function remove_orphans($stage = 0) {
        }
 
        // Call it again if not all entries were purged
-       if (($stage != 0) AND ($count > 0) AND get_config("system", "worker")) {
-               proc_run(PRIORITY_LOW, 'include/dbclean.php');
+       if (($stage != 0) AND ($count > 0) AND Config::get("system", "worker")) {
+               proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
        }
 
 }
index 4a8bac198211afa493f81ca9cd96009c81b3a6a5..5c89f49fb93242cf09381104a3a8ed178a83c75e 100644 (file)
@@ -586,9 +586,16 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "uid" => array("uid"),
-                                       "addr_uid" => array("addr", "uid"),
-                                       "nurl" => array("nurl"),
+                                       "uid_name" => array("uid", "name"),
+                                       "uid_self" => array("uid", "self"),
+                                       "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(
@@ -644,7 +651,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "uid" => array("uid"),
+                                       "uid_start" => array("uid", "start"),
                                        )
                        );
        $database["fcontact"] = array(
@@ -669,7 +676,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "addr" => array("addr"),
+                                       "addr" => array("addr(32)"),
                                        )
                        );
        $database["ffinder"] = array(
@@ -692,7 +699,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "server" => array("server"),
+                                       "server" => array("server(32)"),
                                        )
                        );
        $database["fsuggest"] = array(
@@ -754,10 +761,10 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "nurl" => array("nurl"),
-                                       "name" => array("name"),
-                                       "nick" => array("nick"),
-                                       "addr" => array("addr"),
+                                       "nurl" => array("nurl(32)"),
+                                       "name" => array("name(32)"),
+                                       "nick" => array("nick(32)"),
+                                       "addr" => array("addr(32)"),
                                        "updated" => array("updated"),
                                        )
                        );
@@ -772,7 +779,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "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"),
                                        "zcid" => array("zcid"),
                                        )
@@ -799,7 +806,9 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "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(
@@ -822,7 +831,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "nurl" => array("nurl"),
+                                       "nurl" => array("nurl(32)"),
                                        )
                        );
        $database["hook"] = array(
@@ -937,24 +946,17 @@ function db_definition($charset) {
                                        "uid_network_received" => array("uid","network","received"),
                                        "uid_received" => array("uid","received"),
                                        "uid_network_commented" => array("uid","network","commented"),
-                                       "uid_commented" => array("uid","commented"),
                                        "uid_title" => array("uid","title"),
                                        "uid_thrparent" => array("uid","thr-parent"),
                                        "uid_parenturi" => array("uid","parent-uri"),
                                        "uid_contactid_id" => array("uid","contact-id","id"),
                                        "uid_contactid_created" => array("uid","contact-id","created"),
-                                       "gcontactid_uid_created" => array("gcontact-id","uid","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_wall_created" => array("uid","wall","created"),
                                        "resource-id" => array("resource-id"),
                                        "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)"),
-                                       "uid_wall_parent_created" => array("uid","wall","parent","created"),
                                        "uid_type_changed" => array("uid","type","changed"),
                                        "contactid_verb" => array("contact-id","verb"),
                                        "deleted_changed" => array("deleted","changed"),
@@ -976,7 +978,7 @@ function db_definition($charset) {
                                        "PRIMARY" => array("id"),
                                        "uid" => array("uid"),
                                        "sid" => array("sid"),
-                                       "service" => array("service"),
+                                       "service" => array("service(32)"),
                                        "iid" => array("iid"),
                                        )
                        );
@@ -1014,11 +1016,10 @@ function db_definition($charset) {
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
                                        "uid" => array("uid"),
-                                       "guid" => array("guid"),
+                                       "uid_seen" => array("uid", "seen"),
                                        "convid" => array("convid"),
-                                       "reply" => array("reply"),
-                                       "uri" => array("uri"),
-                                       "parent-uri" => array("parent-uri"),
+                                       "uri" => array("uri(64)"),
+                                       "parent-uri" => array("parent-uri(64)"),
                                        )
                        );
        $database["mailacct"] = array(
@@ -1074,7 +1075,11 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "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(
@@ -1088,7 +1093,6 @@ function db_definition($charset) {
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
                                        "master-parent-item" => array("master-parent-item"),
-                                       "receiver-uid" => array("receiver-uid"),
                                        )
                        );
        $database["oembed"] = array(
@@ -1157,9 +1161,9 @@ function db_definition($charset) {
                                        "PRIMARY" => array("id"),
                                        "uid_contactid" => array("uid", "contact-id"),
                                        "uid_profile" => array("uid", "profile"),
-                                       "uid_album_created" => array("uid", "album", "created"),
-                                       "resource-id" => array("resource-id"),
-                                       "guid" => array("guid"),
+                                       "uid_album_created" => array("uid", "album(32)", "created"),
+                                       "uid_album_resource-id_created" => array("uid", "album(32)", "resource-id(64)", "created"),
+                                       "resource-id" => array("resource-id(64)"),
                                        )
                        );
        $database["poll"] = array(
@@ -1252,7 +1256,6 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "hometown" => array("hometown"),
                                        )
                        );
        $database["profile_check"] = array(
@@ -1325,7 +1328,6 @@ function db_definition($charset) {
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
                                        "uid" => array("uid"),
-                                       "term" => array("term"),
                                        )
                        );
        $database["session"] = array(
@@ -1337,7 +1339,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "sid" => array("sid"),
+                                       "sid" => array("sid(64)"),
                                        "expire" => array("expire"),
                                        )
                        );
@@ -1389,12 +1391,11 @@ function db_definition($charset) {
                        "indexes" => array(
                                        "PRIMARY" => array("tid"),
                                        "oid_otype_type_term" => array("oid","otype","type","term"),
-                                       "uid_term_tid" => array("uid","term","tid"),
-                                       "type_term" => array("type","term"),
-                                       "uid_otype_type_term_global_created" => array("uid","otype","type","term","global","created"),
-                                       "otype_type_term_tid" => array("otype","type","term","tid"),
-                                       "uid_otype_type_url" => array("uid","otype","type","url"),
-                                       "guid" => array("guid"),
+                                       "uid_term_tid" => array("uid","term(32)","tid"),
+                                       "type_term" => array("type","term(32)"),
+                                       "uid_otype_type_term_global_created" => array("uid","otype","type","term(32)","global","created"),
+                                       "uid_otype_type_url" => array("uid","otype","type","url(64)"),
+                                       "guid" => array("guid(64)"),
                                        )
                        );
        $database["thread"] = array(
@@ -1434,9 +1435,6 @@ function db_definition($charset) {
                                        "uid_network_created" => array("uid","network","created"),
                                        "uid_contactid_commented" => array("uid","contact-id","commented"),
                                        "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_commented" => array("uid","commented"),
                                        )
@@ -1502,7 +1500,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("uid"),
-                                       "nickname" => array("nickname"),
+                                       "nickname" => array("nickname(32)"),
                                        )
                        );
        $database["userd"] = array(
@@ -1512,7 +1510,7 @@ function db_definition($charset) {
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("id"),
-                                       "username" => array("username"),
+                                       "username" => array("username(32)"),
                                        )
                        );
        $database["workerqueue"] = array(
index db2cca471bcad6cf6a81f4b7f72befa6f3fbab60..fc88c79bf2be203ad9609caf7c7c7bf74ab5e82f 100644 (file)
@@ -325,8 +325,9 @@ class Diaspora {
                                logger("delivering to: ".$rr["username"]);
                                self::dispatch($rr,$msg);
                        }
-               } else
-                       logger("No subscribers for ".$msg["author"]." ".print_r($msg, true));
+               } else {
+                       logger("No subscribers for ".$msg["author"]." ".print_r($msg, true), LOGGER_DEBUG);
+               }
 
                return $message_id;
        }
@@ -736,13 +737,28 @@ class Diaspora {
         * @return The contact id
         */
        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",
                        intval($uid),
                        dbesc($handle)
                );
 
-               if ($r)
+               if (dbm::is_result($r)) {
                        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);
                $nurl_sql = "%%://".$handle_parts[1]."%%/profile/".$handle_parts[0];
@@ -751,9 +767,11 @@ class Diaspora {
                        intval($uid),
                        dbesc($nurl_sql)
                );
-               if($r)
+               if (dbm::is_result($r)) {
                        return $r[0];
+               }
 
+               logger("Haven't found contact for user ".$uid." and handle ".$handle, LOGGER_DEBUG);
                return false;
        }
 
@@ -833,7 +851,7 @@ class Diaspora {
                        dbesc($guid)
                );
 
-               if ($r) {
+               if (dbm::is_result($r)) {
                        logger("message ".$guid." already exists for user ".$uid);
                        return $r[0]["id"];
                }
index aa29e117a697d8b6c983c42f1dd5616a9c857cad..ebc27309dbe61710b76241f84bfd28e6f8ce0b1d 100644 (file)
@@ -105,7 +105,7 @@ function notification($params) {
                // If so don't create a second notification
 
                $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_COMMENT),
                        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
 
                $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_COMMENT),
                        dbesc($params['link']),
index a1ff9bb3364dbb735cadcf275855d21fa7dd59dd..616018bb77a629c848f875652b9ce7d7876ced6f 100644 (file)
@@ -206,7 +206,7 @@ function bbtoevent($s) {
 }
 
 
-function sort_by_date(App &$a) {
+function sort_by_date(App $a) {
 
        usort($a,'ev_compare');
        return $a;
@@ -495,7 +495,7 @@ function get_event_strings() {
 
 /**
  * @brief Get an event by its event ID
- * 
+ *
  * @param type $owner_uid The User ID of the owner of the event
  * @param type $event_params An assoziative array with
  *     int 'event_id' => The ID of the event in the event table
@@ -523,15 +523,15 @@ function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') {
 
 /**
  * @brief Get all events in a specific timeframe
- * 
+ *
  * @param int $owner_uid The User ID of the owner of the events
  * @param array $event_params An assoziative array with
- *     int 'ignored' => 
+ *     int 'ignored' =>
  *     string 'start' => Start time of the timeframe
  *     string 'finish' => Finish time of the timeframe
- *     string 'adjust_start' => 
  *     string 'adjust_start' =>
- *     
+ *     string 'adjust_start' =>
+ *
  * @param string $sql_extra Additional sql conditions (e.g. permission request)
  * @return array Query results
  */
@@ -564,7 +564,7 @@ function events_by_date($owner_uid = 0, $event_params, $sql_extra = '') {
 
 /**
  * @brief Convert an array query results in an arry which could be used by the events template
- * 
+ *
  * @param array $arr Event query array
  * @return array Event array for the template
  */
@@ -623,11 +623,11 @@ function process_events ($arr) {
 
 /**
  * @brief Format event to export format (ical/csv)
- * 
+ *
  * @param array $events Query result for events
  * @param string $format The output format (ical/csv)
  * @param string $timezone The timezone of the user (not implemented yet)
- * 
+ *
  * @return string Content according to selected export format
  */
 function event_format_export ($events, $format = 'ical', $timezone) {
@@ -641,7 +641,7 @@ function event_format_export ($events, $format = 'ical', $timezone) {
                        $o = '"Subject", "Start Date", "Start Time", "Description", "End Date", "End Time", "Location"' . PHP_EOL;
 
                        foreach ($events as $event) {
-                       /// @todo the time / date entries don't include any information about the 
+                       /// @todo the time / date entries don't include any information about the
                        // timezone the event is scheduled in :-/
                                $tmp1 = strtotime($event['start']);
                                $tmp2 = strtotime($event['finish']);
@@ -650,7 +650,7 @@ function event_format_export ($events, $format = 'ical', $timezone) {
                                $o .= '"'.$event['summary'].'", "'.strftime($date_format, $tmp1) .
                                        '", "'.strftime($time_format, $tmp1).'", "'.$event['desc'] .
                                        '", "'.strftime($date_format, $tmp2) .
-                                       '", "'.strftime($time_format, $tmp2) . 
+                                       '", "'.strftime($time_format, $tmp2) .
                                        '", "'.$event['location'].'"' . PHP_EOL;
                        }
                        break;
@@ -672,7 +672,7 @@ function event_format_export ($events, $format = 'ical', $timezone) {
                        foreach ($events as $event) {
                                if ($event['adjust'] == 1) {
                                        $UTC = 'Z';
-                               } else { 
+                               } else {
                                        $UTC = '';
                                }
                                $o .= 'BEGIN:VEVENT' . PHP_EOL;
@@ -716,16 +716,16 @@ function event_format_export ($events, $format = 'ical', $timezone) {
 
 /**
  * @brief Get all events for a user ID
- * 
+ *
  *    The query for events is done permission sensitive
  *    If the user is the owner of the calendar he/she
  *    will get all of his/her available events.
  *    If the user is only a visitor only the public events will
  *    be available
- * 
+ *
  * @param int $uid The user ID
  * @param int $sql_extra Additional sql conditions for permission
- * 
+ *
  * @return array Query results
  */
 function events_by_uid($uid = 0, $sql_extra = '') {
@@ -736,8 +736,8 @@ function events_by_uid($uid = 0, $sql_extra = '') {
        if($sql_extra == '')
                $sql_extra = " AND `allow_cid` = '' AND `allow_gid` = '' ";
 
-       //  does the user who requests happen to be the owner of the events 
-       //  requested? then show all of your events, otherwise only those that 
+       //  does the user who requests happen to be the owner of the events
+       //  requested? then show all of your events, otherwise only those that
        //  don't have limitations set in allow_cid and allow_gid
        if (local_user() == $uid) {
                $r = q("SELECT `start`, `finish`, `adjust`, `summary`, `desc`, `location`, `nofinish`
@@ -756,7 +756,7 @@ function events_by_uid($uid = 0, $sql_extra = '') {
 }
 
 /**
- * 
+ *
  * @param int $uid The user ID
  * @param string $format Output format (ical/csv)
  * @return array With the results
@@ -764,7 +764,7 @@ function events_by_uid($uid = 0, $sql_extra = '') {
  *     string 'format' => The output format
  *     string 'extension' => The file extension of the output format
  *     string 'content' => The formatted output content
- * 
+ *
  * @todo Respect authenticated users with events_by_uid()
  */
 function event_export($uid, $format = 'ical') {
@@ -815,7 +815,7 @@ function event_export($uid, $format = 'ical') {
 
 /**
  * @brief Get the events widget
- * 
+ *
  * @return string Formated html of the evens widget
  */
 function widget_events() {
@@ -835,11 +835,11 @@ function widget_events() {
 
        // Cal logged in user (test permission at foreign profile page)
        // If the $owner uid is available we know it is part of one of the profile pages (like /cal)
-       // So we have to test if if it's the own profile page of the logged in user 
+       // So we have to test if if it's the own profile page of the logged in user
        // or a foreign one. For foreign profile pages we need to check if the feature
        // for exporting the cal is enabled (otherwise the widget would appear for logged in users
        // on foreigen profile pages even if the widget is disabled)
-       if(intval($owner_uid) && local_user() !== $owner_uid && ! feature_enabled($owner_uid, "export_calendar")) 
+       if(intval($owner_uid) && local_user() !== $owner_uid && ! feature_enabled($owner_uid, "export_calendar"))
                return;
 
        // If it's a kind of profile page (intval($owner_uid)) return if the user not logged in and
index a302dc34cd661822400c64ff9976cc125f3c08b0..c18bc3a80524d6be8e4719ba78c5f2ae1ece234a 100644 (file)
@@ -31,7 +31,7 @@ require_once("mod/proxy.php");
  * @param int $profile
  * @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",
                dbesc($nickname)
@@ -118,12 +118,12 @@ function profile_load(&$a, $nickname, $profile = 0, $profiledata = array()) {
 
 /**
  * @brief Get all profil data of a local user
- * 
+ *
  * If the viewer is an authenticated remote viewer, the profile displayed is the
  * one that has been configured for his/her viewing in the Contact manager.
  * Passing a non-zero profile ID can also allow a preview of a selected profile
  * by the owner
- * 
+ *
  * @param string $nickname
  * @param int $uid
  * @param int $profile
@@ -177,17 +177,17 @@ function get_profiledata_by_nick($nickname, $uid = 0, $profile = 0) {
 
 /**
  * @brief Formats a profile for display in the sidebar.
- * 
+ *
  * It is very difficult to templatise the HTML completely
  * because of all the conditional logic.
- * 
+ *
  * @param array $profile
  * @param int $block
- * 
+ *
  * @return HTML string stuitable for sidebar inclusion
- * 
+ *
  * @note Returns empty string if passed $profile is wrong type or not populated
- * 
+ *
  * @hooks 'profile_sidebar_enter'
  *      array $profile - profile data
  * @hooks 'profile_sidebar'
@@ -598,7 +598,7 @@ function get_events() {
        ));
 }
 
-function advanced_profile(App &$a) {
+function advanced_profile(App $a) {
 
        $o = '';
        $uid = $a->profile['uid'];
@@ -755,7 +755,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                array(
                        'label'=>t('Status'),
                        'url' => $url,
-                       'sel' => ((!isset($tab)&&$a->argv[0]=='profile')?'active':''),
+                       'sel' => ((!isset($tab) && $a->argv[0]=='profile')?'active':''),
                        'title' => t('Status Messages and Posts'),
                        'id' => 'status-tab',
                        'accesskey' => 'm',
@@ -771,7 +771,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                array(
                        'label' => t('Photos'),
                        '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'),
                        'id' => 'photo-tab',
                        'accesskey' => 'h',
@@ -779,7 +779,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                array(
                        'label' => t('Videos'),
                        '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'),
                        'id' => 'video-tab',
                        'accesskey' => 'v',
@@ -791,7 +791,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                        $tabs[] = array(
                                'label' => t('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'),
                                'id' => 'events-tab',
                                'accesskey' => 'e',
@@ -802,7 +802,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                $tabs[] = array(
                                'label' => t('Events'),
                                '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'),
                                'id' => 'events-tab',
                                'accesskey' => 'e',
@@ -813,7 +813,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                $tabs[] = array(
                        'label' => t('Personal 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'),
                        'id' => 'notes-tab',
                        'accesskey' => 't',
@@ -824,7 +824,7 @@ function profile_tabs($a, $is_owner=False, $nickname=Null){
                $tabs[] = array(
                        'label' => t('Contacts'),
                        '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'),
                        'id' => 'viewcontacts-tab',
                        'accesskey' => 'k',
@@ -845,7 +845,7 @@ function get_my_url() {
        return false;
 }
 
-function zrl_init(App &$a) {
+function zrl_init(App $a) {
        $tmp_str = get_my_url();
        if(validate_url($tmp_str)) {
 
@@ -891,7 +891,7 @@ function zrl($s,$force = false) {
  * settings except their own while on this site.
  *
  * @return int user ID
- * 
+ *
  * @note Returns local_user instead of user ID if "always_my_theme"
  *      is set to true
  */
index bd933929d3b6b78ee7e8a3113558cd965e3d152d..fe4c50818ea583c3e02768b8b4ead0866fdb9422 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function nav(App &$a) {
+function nav(App $a) {
 
        /*
         *
index f00f682978ed5d25ebb272fa334bd310956dfdb3..ba64f493dbad9d6addacc1884237627440a17a7d 100644 (file)
@@ -2072,7 +2072,7 @@ class ostatus {
         *
         * @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`
                                FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
index 2beb23ffaf52001396db1ca34d48979bc9c09bdb..7cdd14bf6d3e586894748de06292c933f7173058 100644 (file)
@@ -4,6 +4,9 @@
  * @brief Functions related to photo handling.
  */
 
+use \Friendica\Core\Config;
+use \Friendica\Core\PConfig;
+
 function getGps($exifCoord, $hemi) {
        $degrees = count($exifCoord) > 0 ? gps2Num($exifCoord[0]) : 0;
        $minutes = count($exifCoord) > 1 ? gps2Num($exifCoord[1]) : 0;
@@ -42,16 +45,28 @@ function photo_albums($uid, $update = false) {
        $key = "photo_albums:".$uid.":".local_user().":".remote_user();
        $albums = Cache::get($key);
        if (is_null($albums) OR $update) {
-               /// @todo This query needs to be renewed. It is really slow
-               // At this time we just store the data in the cache
-               $albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`
-                       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'))
-               );
+               if (!Config::get('system', 'no_count', false)) {
+                       /// @todo This query needs to be renewed. It is really slow
+                       // At this time we just store the data in the cache
+                       $albums = qu("SELECT COUNT(DISTINCT `resource-id`) AS `total`, `album`
+                               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'))
+                       );
+               } 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);
        }
        return $albums;
index 83027286798d574c08a9c64acf99fb8d1b08c803..632abf30cb79f612b3002a1104fc32d16905d395 100644 (file)
@@ -296,7 +296,7 @@ function shortenmsg($msg, $limit, $twitter = false) {
  *
  * @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
        $URLSearchString = "^\[\]";
index d8bb7643965963c7ebe195e04e564bcc22b4a947..76e30a6eaca2325950db232bfd119fda8f765d38 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function auto_redir(&$a, $contact_nick) {
+function auto_redir(App $a, $contact_nick) {
 
        // prevent looping
 
@@ -27,13 +27,13 @@ function auto_redir(&$a, $contact_nick) {
                $baseurl = substr($baseurl, $domain_st + 3);
                $nurl = normalise_link($baseurl);
 
-
-               $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",
-                          dbesc($contact_nick),
-                          dbesc($a->user['nickname']),
-                      dbesc($baseurl),
-               dbesc($nurl)
+               /// @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)
+                       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($a->user['nickname']),
+                               dbesc($baseurl),
+                               dbesc($nurl)
                );
 
                if ((! dbm::is_result($r)) || $r[0]['id'] == remote_user()) {
@@ -70,7 +70,7 @@ function auto_redir(&$a, $contact_nick) {
 
                if(strlen($dfrn_id) < 3)
                        return;
-                       
+
                $sec = random_string();
 
                q("INSERT INTO `profile_check` ( `uid`, `cid`, `dfrn_id`, `sec`, `expire`)
@@ -84,9 +84,9 @@ function auto_redir(&$a, $contact_nick) {
 
                $url = curPageURL();
 
-               logger('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG); 
+               logger('auto_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
                $dest = (($url) ? '&destination_url=' . $url : '');
-               goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id 
+               goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
                        . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest );
        }
 
index cd00b5f7b0bbc36a75f511c8f865fe643164f6b7..c37951856249089d95d897eb982ffecc79693dc8 100644 (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;
 
@@ -148,8 +148,8 @@ function can_write_wall(&$a,$owner) {
                                return false;
                        }
 
-                       $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid` 
-                               WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 
+                       $r = q("SELECT `contact`.*, `user`.`page-flags` FROM `contact` INNER JOIN `user` on `user`.`uid` = `contact`.`uid`
+                               WHERE `contact`.`uid` = %d AND `contact`.`id` = %d AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
                                AND `user`.`blockwall` = 0 AND `readonly` = 0  AND ( `contact`.`rel` IN ( %d , %d ) OR `user`.`page-flags` = %d ) LIMIT 1",
                                intval($owner),
                                intval($cid),
@@ -183,10 +183,10 @@ function permissions_sql($owner_id,$remote_verified = false,$groups = null) {
         * default permissions - anonymous user
         */
 
-       $sql = " AND allow_cid = '' 
-                        AND allow_gid = '' 
-                        AND deny_cid  = '' 
-                        AND deny_gid  = '' 
+       $sql = " AND allow_cid = ''
+                        AND allow_gid = ''
+                        AND deny_cid  = ''
+                        AND deny_gid  = ''
        ";
 
        /**
@@ -194,11 +194,11 @@ function permissions_sql($owner_id,$remote_verified = false,$groups = null) {
         */
 
        if(($local_user) && ($local_user == $owner_id)) {
-               $sql = ''; 
+               $sql = '';
        }
 
        /**
-        * Authenticated visitor. Unless pre-verified, 
+        * Authenticated visitor. Unless pre-verified,
         * check that the contact belongs to this $owner_id
         * and load the groups the visitor belongs to.
         * If pre-verified, the caller is expected to have already
@@ -224,11 +224,11 @@ function permissions_sql($owner_id,$remote_verified = false,$groups = null) {
                        if(is_array($groups) && count($groups)) {
                                foreach($groups as $g)
                                        $gs .= '|<' . intval($g) . '>';
-                       } 
+                       }
 
                        /*$sql = sprintf(
-                               " AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' ) 
-                                 AND ( deny_cid  = '' OR  NOT deny_cid REGEXP '<%d>' ) 
+                               " AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' )
+                                 AND ( deny_cid  = '' OR  NOT deny_cid REGEXP '<%d>' )
                                  AND ( allow_gid = '' OR allow_gid REGEXP '%s' )
                                  AND ( deny_gid  = '' OR NOT deny_gid REGEXP '%s')
                                ",
@@ -280,7 +280,7 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
        }
 
        /**
-        * Authenticated visitor. Unless pre-verified, 
+        * Authenticated visitor. Unless pre-verified,
         * check that the contact belongs to this $owner_id
         * and load the groups the visitor belongs to.
         * If pre-verified, the caller is expected to have already
@@ -306,13 +306,13 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
                        if(is_array($groups) && count($groups)) {
                                foreach($groups as $g)
                                        $gs .= '|<' . intval($g) . '>';
-                       } 
+                       }
 
                        $sql = sprintf(
-                               /*" AND ( private = 0 OR ( private in (1,2) AND wall = 1 AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' ) 
-                                 AND ( deny_cid  = '' OR  NOT deny_cid REGEXP '<%d>' ) 
+                               /*" AND ( private = 0 OR ( private in (1,2) AND wall = 1 AND ( allow_cid = '' OR allow_cid REGEXP '<%d>' )
+                                 AND ( deny_cid  = '' OR  NOT deny_cid REGEXP '<%d>' )
                                  AND ( allow_gid = '' OR allow_gid REGEXP '%s' )
-                                 AND ( deny_gid  = '' OR NOT deny_gid REGEXP '%s'))) 
+                                 AND ( deny_gid  = '' OR NOT deny_gid REGEXP '%s')))
                                ",
                                intval($remote_user),
                                intval($remote_user),
@@ -345,29 +345,29 @@ function item_permissions_sql($owner_id,$remote_verified = false,$groups = null)
  *    If the new page contains by any chance external elements, then the used security token is exposed by the referrer.
  *    Actually, important actions should not be triggered by Links / GET-Requests at all, but somethimes they still are,
  *    so this mechanism brings in some damage control (the attacker would be able to forge a request to a form of this type, but not to forms of other types).
- */ 
+ */
 function get_form_security_token($typename = '') {
        $a = get_app();
-       
+
        $timestamp = time();
        $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $timestamp . $typename);
-       
+
        return $timestamp . '.' . $sec_hash;
 }
 
 function check_form_security_token($typename = '', $formname = 'form_security_token') {
        if (!x($_REQUEST, $formname)) return false;
        $hash = $_REQUEST[$formname];
-       
+
        $max_livetime = 10800; // 3 hours
-       
+
        $a = get_app();
-       
+
        $x = explode('.', $hash);
        if (time() > (IntVal($x[0]) + $max_livetime)) return false;
-       
+
        $sec_hash = hash('whirlpool', $a->user['guid'] . $a->user['prvkey'] . session_id() . $x[0] . $typename);
-       
+
        return ($sec_hash == $x[1]);
 }
 
@@ -395,13 +395,13 @@ function check_form_security_token_ForbiddenOnErr($typename = '', $formname = 'f
 
 // Returns an array of group id's this contact is a member of.
 // This array will only contain group id's related to the uid of this
-// DFRN contact. They are *not* neccessarily unique across the entire site. 
+// DFRN contact. They are *not* neccessarily unique across the entire site.
 
 
 if(! function_exists('init_groups_visitor')) {
 function init_groups_visitor($contact_id) {
        $groups = array();
-       $r = q("SELECT `gid` FROM `group_member` 
+       $r = q("SELECT `gid` FROM `group_member`
                WHERE `contact-id` = %d ",
                intval($contact_id)
        );
index 6672b0d32f790a9ad08a7a89b332590cc8682066..77a9f25af9578f4909d0595f290d8b32e6fd1544 100644 (file)
@@ -276,7 +276,7 @@ if(! function_exists('paginate_data')) {
  * @param int $count [optional] item count (used with alt pager)
  * @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 = str_replace('q=','',$stripped);
@@ -369,7 +369,7 @@ if(! function_exists('paginate')) {
  * @param App $a App instance
  * @return string html for pagination #FIXME remove html
  */
-function paginate(App &$a) {
+function paginate(App $a) {
 
        $data = paginate_data($a);
        $tpl = get_markup_template("paginate.tpl");
@@ -384,7 +384,7 @@ if(! function_exists('alt_pager')) {
  * @param int $i
  * @return string html for pagination #FIXME remove html
  */
-function alt_pager(&$a, $i) {
+function alt_pager(App $a, $i) {
 
        $data = paginate_data($a, $i);
        $tpl = get_markup_template("paginate.tpl");
index 0d9ffc35fca2f001fcf6df23db1f03a1e8fd8da5..b774d78c6d6e5578060e541833d75e8e09add95d 100644 (file)
@@ -78,7 +78,7 @@ function import_cleanup($newuid) {
        q("DELETE FROM `pconfig` WHERE uid = %d", $newuid);\r
 }\r
 \r
-function import_account(&$a, $file) {\r
+function import_account(App $a, $file) {\r
        logger("Start user import from " . $file['tmp_name']);\r
        /*\r
          STEPS\r
index eedddf1e5b46c97968e8bcf6835e4dc79dffbad2..75948a008834abf70279834a1911dbe39a913f96 100644 (file)
@@ -3,7 +3,7 @@
 require_once("mod/hostxrd.php");\r
 require_once("mod/nodeinfo.php");\r
 \r
-function _well_known_init(App &$a){\r
+function _well_known_init(App $a) {\r
        if ($a->argc > 1) {\r
                switch($a->argv[1]) {\r
                        case "host-meta":\r
@@ -21,7 +21,7 @@ function _well_known_init(App &$a){
        killme();\r
 }\r
 \r
-function wk_social_relay(App &$a) {\r
+function wk_social_relay(App $a) {\r
 \r
        define('SR_SCOPE_ALL', 'all');\r
        define('SR_SCOPE_TAGS', 'tags');\r
index 29f17d6e414d7765224922e3307363bd06be9887..892b59655f01dea4cab10ca8e2b9fbe7d036ebac 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/Scrape.php');
 
-function acctlink_init(App &$a) {
+function acctlink_init(App $a) {
 
        if(x($_GET,'addr')) {
                $addr = trim($_GET['addr']);
index 802b0a399fd353d3b0c976f11ace6a1bc7264bc4..04aa9f50a6ff3b6ce4c847cc41717ded31a57314 100644 (file)
@@ -3,7 +3,7 @@
 
 require_once("include/acl_selectors.php");
 
-function acl_init(App &$a){
+function acl_init(App $a) {
        acl_lookup($a);
 }
 
index fd57f92d5f54cc6ba204dfa203249ccb24a669b5..b1bc96fd4f6fb548be94396a6653a2dc1e9894dd 100644 (file)
@@ -2,7 +2,7 @@
 
  /**
  * @file mod/admin.php
- * 
+ *
  * @brief Friendica admin
  */
 
@@ -23,7 +23,7 @@ require_once("include/text.php");
  * @param App $a
  *
  */
-function admin_post(App &$a){
+function admin_post(App $a) {
 
 
        if(!is_site_admin()) {
@@ -66,7 +66,7 @@ function admin_post(App &$a){
 
                                $theme = $a->argv[2];
                                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_page = $a->page;
                                                $orig_session_theme = $_SESSION['theme'];
@@ -127,7 +127,7 @@ function admin_post(App &$a){
  * @param App $a
  * @return string
  */
-function admin_content(App &$a) {
+function admin_content(App $a) {
 
        if(!is_site_admin()) {
                return login(false);
@@ -260,7 +260,7 @@ function admin_content(App &$a) {
  * @param App $a
  * @return string
  */
-function admin_page_federation(App &$a) {
+function admin_page_federation(App $a) {
        // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
        // social and statusnet nodes this node is knowing
        //
@@ -316,12 +316,12 @@ function admin_page_federation(App &$a) {
                                $newVC = $vv['total'];
                                $newVV = $vv['version'];
                                $posDash = strpos($newVV, '-');
-                               if($posDash) 
+                               if($posDash)
                                        $newVV = substr($newVV, 0, $posDash);
                                if(isset($newV[$newVV]))
-                                       $newV[$newVV] += $newVC; 
+                                       $newV[$newVV] += $newVC;
                                else
-                                       $newV[$newVV] = $newVC; 
+                                       $newV[$newVV] = $newVC;
                        }
                        foreach ($newV as $key => $value) {
                                array_push($newVv, array('total'=>$value, 'version'=>$key));
@@ -393,7 +393,7 @@ function admin_page_federation(App &$a) {
  * @param App $a
  * @return string
  */
-function admin_page_queue(App &$a) {
+function admin_page_queue(App $a) {
        // get content from the queue table
        $r = q("SELECT `c`.`name`, `c`.`nurl`, `q`.`id`, `q`.`network`, `q`.`created`, `q`.`last`
                        FROM `queue` AS `q`, `contact` AS `c`
@@ -427,7 +427,7 @@ function admin_page_queue(App &$a) {
  * @param App $a
  * @return string
  */
-function admin_page_summary(App &$a) {
+function admin_page_summary(App $a) {
        global $db;
        // 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",
@@ -501,10 +501,10 @@ function admin_page_summary(App &$a) {
 
 /**
  * @brief Process send data from Admin Site Page
- * 
+ *
  * @param App $a
  */
-function admin_page_site_post(App &$a) {
+function admin_page_site_post(App $a) {
        if(!x($_POST,"page_site")) {
                return;
        }
@@ -845,7 +845,7 @@ function admin_page_site_post(App &$a) {
  * @param  App $a
  * @return string
  */
-function admin_page_site(App &$a) {
+function admin_page_site(App $a) {
 
        /* Installed langs */
        $lang_choices = get_available_languages();
@@ -1072,7 +1072,7 @@ function admin_page_site(App &$a) {
  * @param App $a
  * @return string
  **/
-function admin_page_dbsync(App &$a) {
+function admin_page_dbsync(App $a) {
 
        $o = '';
 
@@ -1152,10 +1152,10 @@ function admin_page_dbsync(App &$a) {
 
 /**
  * @brief Process data send by Users admin page
- * 
+ *
  * @param App $a
  */
-function admin_page_users_post(App &$a){
+function admin_page_users_post(App $a) {
        $pending     = (x($_POST, 'pending')           ? $_POST['pending']           : array());
        $users       = (x($_POST, 'user')              ? $_POST['user']               : array());
        $nu_name     = (x($_POST, 'new_user_name')     ? $_POST['new_user_name']     : '');
@@ -1168,7 +1168,7 @@ function admin_page_users_post(App &$a){
        if (!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
                require_once('include/user.php');
 
-               $result = create_user(array('username'=>$nu_name, 'email'=>$nu_email, 
+               $result = create_user(array('username'=>$nu_name, 'email'=>$nu_email,
                        'nickname'=>$nu_nickname, 'verified'=>1, 'language'=>$nu_language));
                if (! $result['success']) {
                        notice($result['message']);
@@ -1260,7 +1260,7 @@ function admin_page_users_post(App &$a){
  * @param App $a
  * @return string
  */
-function admin_page_users(App &$a){
+function admin_page_users(App $a) {
        if($a->argc>2) {
                $uid = $a->argv[3];
                $user = q("SELECT `username`, `blocked` FROM `user` WHERE `uid` = %d", intval($uid));
@@ -1396,7 +1396,7 @@ function admin_page_users(App &$a){
                array(t('Name'), t('Email'), t('Register date'), t('Last login'), t('Last item'),  t('Account')),
                $valid_orders
        );
-       
+
        $t = get_markup_template("admin_users.tpl");
        $o = replace_macros($t, array(
                // strings //
@@ -1460,7 +1460,7 @@ function admin_page_users(App &$a){
  * @param App $a
  * @return string
  */
-function admin_page_plugins(App &$a){
+function admin_page_plugins(App $a) {
 
        /*
         * Single plugin
@@ -1588,7 +1588,7 @@ function admin_page_plugins(App &$a){
                '$baseurl' => App::get_baseurl(true),
                '$function' => 'plugins',
                '$plugins' => $plugins,
-               '$pcount' => count($plugins), 
+               '$pcount' => count($plugins),
                '$noplugshint' => sprintf(t('There are currently no plugins available on your node. You can find the official plugin repository at %1$s and might find other interesting plugins in the open plugin registry at %2$s'), 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'),
                '$form_security_token' => get_form_security_token("admin_themes"),
        ));
@@ -1669,7 +1669,7 @@ function rebuild_theme_table($themes) {
  * @param App $a
  * @return string
  */
-function admin_page_themes(App &$a){
+function admin_page_themes(App $a) {
 
        $allowed_themes_str = get_config('system','allowed_themes');
        $allowed_themes_raw = explode(',',$allowed_themes_str);
@@ -1749,7 +1749,7 @@ function admin_page_themes(App &$a){
 
                $admin_form="";
                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_page = $a->page;
                                $orig_session_theme = $_SESSION['theme'];
@@ -1847,10 +1847,10 @@ function admin_page_themes(App &$a){
 
 /**
  * @brief Prosesses data send by Logs admin page
- * 
+ *
  * @param App $a
  */
-function admin_page_logs_post(App &$a) {
+function admin_page_logs_post(App $a) {
        if (x($_POST,"page_logs")) {
                check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
 
@@ -1884,7 +1884,7 @@ function admin_page_logs_post(App &$a) {
  * @param App $a
  * @return string
  */
-function admin_page_logs(App &$a){
+function admin_page_logs(App $a) {
 
        $log_choices = array(
                LOGGER_NORMAL   => 'Normal',
@@ -1893,7 +1893,7 @@ function admin_page_logs(App &$a){
                LOGGER_DATA     => 'Data',
                LOGGER_ALL      => 'All'
        );
-       
+
        if (ini_get('log_errors')) {
                $phplogenabled = t('PHP log currently enabled.');
        } else {
@@ -1941,7 +1941,7 @@ function admin_page_logs(App &$a){
  * @param App $a
  * @return string
  */
-function admin_page_viewlogs(App &$a){
+function admin_page_viewlogs(App $a) {
        $t = get_markup_template("admin_viewlogs.tpl");
        $f = get_config('system','logfile');
        $data = '';
@@ -1980,10 +1980,10 @@ function admin_page_viewlogs(App &$a){
 
 /**
  * @brief Prosesses data send by the features admin page
- * 
+ *
  * @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');
 
@@ -2017,20 +2017,20 @@ function admin_page_features_post(App &$a) {
 
 /**
  * @brief Subpage for global additional feature management
- * 
+ *
  * This functin generates the subpage 'Manage Additional Features'
  * for the admin panel. At this page the admin can set preferences
- * for the user settings of the 'additional features'. If needed this 
+ * for the user settings of the 'additional features'. If needed this
  * preferences can be locked through the admin.
- * 
+ *
  * The returned string contains the HTML code of the subpage 'Manage
  * Additional Features'
- * 
+ *
  * @param App $a
  * @return string
  */
-function admin_page_features(App &$a) {
-       
+function admin_page_features(App $a) {
+
        if((argc() > 1) && (argv(1) === 'features')) {
                $arr = array();
                $features = get_features(false);
@@ -2049,7 +2049,7 @@ function admin_page_features(App &$a) {
                                );
                        }
                }
-               
+
                $tpl = get_markup_template("admin_settings_features.tpl");
                $o .= replace_macros($tpl, array(
                        '$form_security_token' => get_form_security_token("admin_manage_features"),
index 7a134a7be190346c215d5d69b53ae208a576f098..f51070bbe86d472216892b3685cc34fb19680520 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 require_once('mod/contacts.php');
 
-function allfriends_content(App &$a) {
+function allfriends_content(App $a) {
 
        $o = '';
        if (! local_user()) {
index 3fcdb42c8dd599306870815a7197ba99f0c0fec1..5f9f97e3f13507c12e1d0bf2d40043b3185b652f 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function amcd_content(App &$a) {
+function amcd_content(App $a) {
 //header("Content-type: text/json");
 echo <<< EOT
 {
index 74a0cff6f4a17d3ecf1cb66e55eb1075320378f5..3916636cfd32f02bbdbdbfa1d28d4a1251db792a 100644 (file)
@@ -20,7 +20,7 @@ function oauth_get_client($request){
        return $r[0];
 }
 
-function api_post(App &$a) {
+function api_post(App $a) {
 
        if (! local_user()) {
                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'){
                /*
                 * api/oauth/authorize interact with the user. return a standard page
index 4d6395e4ea64673f33ad3fd0517a15191d924393..199ce0f9188021b27e93d99391d5e2d9103d5774 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function apps_content(App &$a) {
+function apps_content(App $a) {
     $privateaddons = get_config('config','private_addons');
       if ($privateaddons === "1") {
        if((! (local_user())))  {
@@ -20,6 +20,6 @@ function apps_content(App &$a) {
                '$apps' => $a->apps,
        ));
 
-       
+
 
 }
index 3b1fc0ec82514fe0111e0ad50342810d37696d31..dd7154dfe1a61033c370e3ea9cd8fea02111d26d 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/security.php');
 
-function attach_init(App &$a) {
+function attach_init(App $a) {
 
        if($a->argc != 2) {
                notice( t('Item not available.') . EOL);
index 5129f5bf594422486c23579e2b977555b39e48a8..e8ea11c94e904305d6d89985c5ab730e6cfcabb6 100644 (file)
@@ -9,55 +9,55 @@ function visible_lf($s) {
        return str_replace("\n",'<br />', $s);
 }
 
-function babel_content(App &$a) {
+function babel_content(App $a) {
 
        $o .= '<h1>Babel Diagnostic</h1>';
 
        $o .= '<form action="babel" method="post">';
        $o .= t('Source (bbcode) text:') . EOL . '<textarea name="text" >' . htmlspecialchars($_REQUEST['text']) .'</textarea>' . EOL;
-       $o .= '<input type="submit" name="submit" value="Submit" /></form>'; 
+       $o .= '<input type="submit" name="submit" value="Submit" /></form>';
 
        $o .= '<br /><br />';
 
        $o .= '<form action="babel" method="post">';
        $o .= t('Source (Diaspora) text to convert to BBcode:') . EOL . '<textarea name="d2bbtext" >' . htmlspecialchars($_REQUEST['d2bbtext']) .'</textarea>' . EOL;
-       $o .= '<input type="submit" name="submit" value="Submit" /></form>'; 
+       $o .= '<input type="submit" name="submit" value="Submit" /></form>';
 
        $o .= '<br /><br />';
 
        if(x($_REQUEST,'text')) {
 
                $text = trim($_REQUEST['text']);
-               $o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($text) . EOL. EOL; 
+               $o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($text) . EOL. EOL;
 
                $html = bbcode($text);
-               $o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL; 
-               $o .= htmlspecialchars($html). EOL. EOL; 
+               $o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL;
+               $o .= htmlspecialchars($html). EOL. EOL;
 
                //$html = bbcode($text);
-               $o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL; 
-               $o .= $html. EOL. EOL; 
+               $o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL;
+               $o .= $html. EOL. EOL;
 
                $bbcode = html2bbcode($html);
-               $o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($bbcode) . EOL. EOL; 
+               $o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($bbcode) . EOL. EOL;
 
                $diaspora = bb2diaspora($text);
-               $o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($diaspora) . EOL. EOL; 
+               $o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($diaspora) . EOL. EOL;
 
                $html = Markdown($diaspora);
-               $o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL; 
-               $o .= $html. EOL. EOL; 
+               $o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL;
+               $o .= $html. EOL. EOL;
 
                $bbcode = diaspora2bb($diaspora);
-               $o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($bbcode) . EOL. EOL; 
+               $o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($bbcode) . EOL. EOL;
 
                $bbcode = html2bbcode($html);
-               $o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($bbcode) . EOL. EOL; 
+               $o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($bbcode) . EOL. EOL;
 
 
 
@@ -66,13 +66,13 @@ function babel_content(App &$a) {
        if(x($_REQUEST,'d2bbtext')) {
 
                $d2bbtext = trim($_REQUEST['d2bbtext']);
-               $o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($d2bbtext) . EOL. EOL; 
+               $o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($d2bbtext) . EOL. EOL;
 
 
                $bb = diaspora2bb($d2bbtext);
-               $o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL; 
-               $o .= visible_lf($bb) . EOL. EOL; 
+               $o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL;
+               $o .= visible_lf($bb) . EOL. EOL;
        }
 
        return $o;
index 9bc8c3353555a929c350a1bf739913ff32b390ff..c4ef8457044ed64913eb15f3af0c385a69f5c74d 100644 (file)
@@ -3,11 +3,11 @@
 require_once('include/conversation.php');
 require_once('include/items.php');
 
-function bookmarklet_init(App &$a) {
+function bookmarklet_init(App $a) {
        $_GET["mode"] = "minimal";
 }
 
-function bookmarklet_content(App &$a) {
+function bookmarklet_content(App $a) {
        if (!local_user()) {
                $o = '<h2>'.t('Login').'</h2>';
                $o .= login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
index 7cb36e7a54fc9eaf6bd1a172fb9d17755ef4ed68..b3cd1e3221a215e2b81bd5abe1ffb641ac54b8a9 100644 (file)
@@ -9,7 +9,7 @@
 require_once('include/event.php');
 require_once('include/redir.php');
 
-function cal_init(App &$a) {
+function cal_init(App $a) {
        if($a->argc > 1)
                auto_redir($a, $a->argv[1]);
 
@@ -64,7 +64,7 @@ function cal_init(App &$a) {
        return;
 }
 
-function cal_content(App &$a) {
+function cal_content(App $a) {
        nav_set_selected('events');
 
        $editselect = 'none';
index 90e41fb6d5e1d821dac470aff382c6076919dd83..3c5df6e38ba12a861c3fba117ff786d6a9d111e4 100644 (file)
@@ -5,19 +5,19 @@
  */
 
 
-function cb_init(App &$a) {
+function cb_init(App $a) {
        call_hooks('cb_init');
 }
 
-function cb_post(App &$a) {
+function cb_post(App $a) {
        call_hooks('cb_post', $_POST);
 }
 
-function cb_afterpost(App &$a) {
+function cb_afterpost(App $a) {
        call_hooks('cb_afterpost');
 }
 
-function cb_content(App &$a) {
+function cb_content(App $a) {
        $o = '';
        call_hooks('cb_content', $o);
        return $o;
index 26ef7e48b782af922433c3eb4f1a8fb4515649f2..5a40663f9eb6445e48f44d5c4e82ac08639e9dc9 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 require_once('mod/contacts.php');
 
-function common_content(App &$a) {
+function common_content(App $a) {
 
        $o = '';
 
index 2c2ea32b33cc5ee7e4413c14bc9dddc9beb08946..7c92ff462f65aeda743ffa3dcb4636aa376c56f3 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function community_init(App &$a) {
+function community_init(App $a) {
        if (! local_user()) {
                unset($_SESSION['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 = '';
 
@@ -121,7 +121,7 @@ function community_getitems($start, $itemspage) {
                return(community_getpublicitems($start, $itemspage));
 
        $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 `item` ON `item`.`id` = `thread`.`iid`
                AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = ''
index 553c7d6cd38b54f1cc4b5657c16b6da6b2b86e4a..5c4cd79868ef63a43a3c1c40a74a05204c7f9cf9 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/group.php');
 
-function contactgroup_content(App &$a) {
+function contactgroup_content(App $a) {
 
 
        if (! local_user()) {
index 38e0992257d9f49f67508c6c9fd5b290e0c64416..7882fac1da7ebae1ae8532afaf57c0405ad87b3d 100644 (file)
@@ -7,7 +7,7 @@ require_once('include/Scrape.php');
 require_once('mod/proxy.php');
 require_once('include/Photo.php');
 
-function contacts_init(App &$a) {
+function contacts_init(App $a) {
        if (! local_user()) {
                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'];
        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()) {
                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;
        $o = '';
@@ -831,13 +831,13 @@ function contacts_content(App &$a) {
 
 /**
  * @brief List of pages for the Contact TabBar
- * 
+ *
  * Available Pages are 'Status', 'Profile', 'Contacts' and 'Common Friends'
- * 
+ *
  * @param app $a
  * @param int $contact_id The ID of the contact
  * @param int $active_tab 1 if tab should be marked as active
- * 
+ *
  * @return array with with contact TabBar data
  */
 function contacts_tab($a, $contact_id, $active_tab) {
@@ -961,9 +961,9 @@ function _contact_detail_for_template($rr){
 
 /**
  * @brief Gives a array with actions which can performed to a given contact
- * 
+ *
  * This includes actions like e.g. 'block', 'hide', 'archive', 'delete' and others
- * 
+ *
  * @param array $contact Data about the Contact
  * @return array with contact related actions
  */
@@ -1019,7 +1019,7 @@ function contact_actions($contact) {
 
        $contact_actions['delete'] = array(
                                                'label' => t('Delete'),
-                                               'url'   => 'contacts/' . $contact['id'] . '/drop', 
+                                               'url'   => 'contacts/' . $contact['id'] . '/drop',
                                                'title' => t('Delete contact'),
                                                'sel'   => '',
                                                'id'    => 'delete',
index 2377032a7939c7fd4a21911f9a1ad48da3fdd751..43f3fc2ba686e9acfb39d119c114262a4700a95c 100644 (file)
@@ -16,7 +16,7 @@
 // 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');
 
@@ -61,7 +61,7 @@ function content_content(&$a, $update = 0) {
 
        $o = '';
 
-       
+
 
        $contact_id = $a->cid;
 
@@ -100,7 +100,7 @@ function content_content(&$a, $update = 0) {
                        $def_acl = array('allow_cid' => $str);
        }
 
-       
+
        $sql_options  = (($star) ? " and starred = 1 " : '');
        $sql_options .= (($bmark) ? " and bookmark = 1 " : '');
 
@@ -137,7 +137,7 @@ function content_content(&$a, $update = 0) {
        }
        elseif($cid) {
 
-               $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d 
+               $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d
                                AND `blocked` = 0 AND `pending` = 0 LIMIT 1",
                        intval($cid)
                );
@@ -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('mod/proxy.php');
@@ -382,7 +382,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                if($mode === 'network-new' || $mode === 'search' || $mode === 'community') {
 
-                       // "New Item View" on network page or search page results 
+                       // "New Item View" on network page or search page results
                        // - just loop through the items and format them minimally for display
 
                        //$tpl = get_markup_template('search_item.tpl');
@@ -402,7 +402,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                || (activity_match($item['verb'],ACTIVITY_DISLIKE))
                                                || activity_match($item['verb'],ACTIVITY_ATTEND)
                                                || activity_match($item['verb'],ACTIVITY_ATTENDNO)
-                                               || activity_match($item['verb'],ACTIVITY_ATTENDMAYBE)) 
+                                               || activity_match($item['verb'],ACTIVITY_ATTENDMAYBE))
                                                && ($item['id'] != $item['parent']))
                                                continue;
                                        $nickname = $item['nickname'];
@@ -450,7 +450,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $drop = array(
                                        'dropping' => $dropping,
-                                       'select' => t('Select'), 
+                                       'select' => t('Select'),
                                        'delete' => t('Delete'),
                                );
 
@@ -540,11 +540,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                $comments[$item['parent']] = 1;
                                        else
                                                $comments[$item['parent']] += 1;
-                               } elseif(! x($comments,$item['parent'])) 
+                               } elseif(! x($comments,$item['parent']))
                                        $comments[$item['parent']] = 0; // avoid notices later on
                        }
 
-                       // map all the like/dislike/attendance activities for each parent item 
+                       // map all the like/dislike/attendance activities for each parent item
                        // Store these in the $alike and $dlike arrays
 
                        foreach($items as $item) {
@@ -633,14 +633,14 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $redirect_url = 'redir/' . $item['cid'] ;
 
-                               $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
+                               $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid'])
                                        || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
                                        ? t('Private Message')
                                        : false);
 
 
                                // Top-level wall post not written by the wall owner (wall-to-wall)
-                               // First figure out who owns it. 
+                               // First figure out who owns it.
 
                                $osparkle = '';
 
@@ -667,13 +667,13 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) {
 
                                                        // The author url doesn't match the owner (typically the contact)
-                                                       // and also doesn't match the contact alias. 
-                                                       // The name match is a hack to catch several weird cases where URLs are 
+                                                       // and also doesn't match the contact alias.
+                                                       // The name match is a hack to catch several weird cases where URLs are
                                                        // all over the park. It can be tricked, but this prevents you from
                                                        // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn
-                                                       // well that it's the same Bob Smith. 
+                                                       // well that it's the same Bob Smith.
 
-                                                       // But it could be somebody else with the same name. It just isn't highly likely. 
+                                                       // But it could be somebody else with the same name. It just isn't highly likely.
 
 
                                                        $owner_url = $item['owner-link'];
@@ -682,7 +682,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                                        $template = $wallwall;
                                                        $commentww = 'ww';
                                                        // If it is our contact, use a friendly redirect link
-                                                       if((link_compare($item['owner-link'],$item['url'])) 
+                                                       if((link_compare($item['owner-link'],$item['url']))
                                                                && ($item['network'] === NETWORK_DFRN)) {
                                                                $owner_url = $redirect_url;
                                                                $osparkle = ' sparkle';
@@ -694,7 +694,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
                                }
 
                                $likebuttons = '';
-                               $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false); 
+                               $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false);
 
                                if($page_writeable) {
 /*                                     if($toplevelpost) {  */
@@ -714,7 +714,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                        if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) {
                                                $comment = replace_macros($cmnt_tpl,array(
-                                                       '$return_path' => '', 
+                                                       '$return_path' => '',
                                                        '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
                                                        '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'),
                                                        '$id' => $item['item_id'],
@@ -756,7 +756,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
 
                                $drop = array(
                                        'dropping' => $dropping,
-                                       'select' => t('Select'), 
+                                       'select' => t('Select'),
                                        'delete' => t('Delete'),
                                );
 
index 84e32b83d578133c70c6be16b7f473fd3f8d523c..f5c34b6105037f094f0098701c4b1a876252853f 100644 (file)
@@ -5,7 +5,7 @@
  * addons repository will be listed though ATM)
  */
 
-function credits_content (App &$a) {
+function credits_content (App $a) {
     /* fill the page with credits */
     $f = fopen('util/credits.txt','r');
     $names = fread($f, filesize('util/credits.txt'));
index c141958e8b958778acddab4e78858f7f2fd5697d..902a129303972a7e18b7c426f84aff37231c5fc8 100644 (file)
@@ -2,7 +2,7 @@
 require_once("include/contact_selectors.php");
 require_once("mod/contacts.php");
 
-function crepair_init(App &$a) {
+function crepair_init(App $a) {
        if (! local_user()) {
                return;
        }
@@ -30,7 +30,7 @@ function crepair_init(App &$a) {
        }
 }
 
-function crepair_post(App &$a) {
+function crepair_post(App $a) {
        if (! local_user()) {
                return;
        }
@@ -96,7 +96,7 @@ function crepair_post(App &$a) {
 
 
 
-function crepair_content(App &$a) {
+function crepair_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 6930a5943a1c8e89c7fe104508c86e47061ea8af..4212ec9b132a4b8ff1a4d4e72d746a9074906ecb 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 require_once('mod/settings.php');
 
-function delegate_init(App &$a) {
+function delegate_init(App $a) {
        return settings_init($a);
 }
 
 
-function delegate_content(App &$a) {
+function delegate_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -90,12 +90,12 @@ function delegate_content(App &$a) {
 
        // find every contact who might be a candidate for delegation
 
-       $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s' 
+       $r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
                and contact.uid = %d and contact.self = 0 and network = '%s' ",
                dbesc(normalise_link(App::get_baseurl())),
                intval(local_user()),
                dbesc(NETWORK_DFRN)
-       ); 
+       );
 
        if (! dbm::is_result($r)) {
                notice( t('No potential page delegates located.') . EOL);
index dc54b912d7c3e686b9250e464b8913dda37ba6d0..57ddc58f2c034e4091353dfcf1688129bcac5bf6 100644 (file)
@@ -22,7 +22,7 @@ require_once('include/enotify.php');
 require_once('include/group.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)) {
 
index eebaa076d94b9bc0ece344ee5e09ae9478f8ee37..d34c959f1f4dbd16094871e348de7cf7230be8a0 100644 (file)
@@ -11,7 +11,7 @@ require_once('include/event.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);
        $dfrn_id      = ((x($_POST,'dfrn_id'))      ? notags(trim($_POST['dfrn_id']))   : '');
        $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')) {
 
index a31a50ad254dbb21f011fa435b95c989a8368317..506f9f162f2159dc1cd8fc75229cff93d11f202c 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/auth.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']              : '');
@@ -163,7 +163,7 @@ function dfrn_poll_init(App &$a) {
 
                        if($final_dfrn_id != $orig_id) {
                                logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
-                               // did not decode properly - cannot trust this site 
+                               // did not decode properly - cannot trust this site
                                xml_status(3, 'Bad decryption');
                        }
 
@@ -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']              : '');
        $challenge    = ((x($_POST,'challenge'))    ? $_POST['challenge']            : '');
@@ -260,7 +260,7 @@ function dfrn_poll_post(App &$a) {
 
                        if($final_dfrn_id != $orig_id) {
                                logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG);
-                               // did not decode properly - cannot trust this site 
+                               // did not decode properly - cannot trust this site
                                xml_status(3, 'Bad decryption');
                        }
 
@@ -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']              : '');
        $type            = ((x($_GET,'type'))            ? $_GET['type']                 : 'data');
index 353f8fdc96d5f49ff053437c2f3c6b4044d54d4f..9e5f022d1bf12f398512603da6d53120a426f830 100644 (file)
@@ -17,7 +17,7 @@ require_once('include/Scrape.php');
 require_once('include/Probe.php');
 require_once('include/group.php');
 
-function dfrn_request_init(App &$a) {
+function dfrn_request_init(App $a) {
 
        if($a->argc > 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.
  *
  */
-function dfrn_request_post(App &$a) {
+function dfrn_request_post(App $a) {
 
        if(($a->argc != 2) || (! 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))) {
                return "";
index f3fbb9eb77cb7834af4a3d5f553e418dbefec160..ba48bb3926c737a91e03587fa9fc3c008c8be8f8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function directory_init(App &$a) {
+function directory_init(App $a) {
        $a->set_pager_itemspage(60);
 
        if(local_user()) {
@@ -20,19 +20,19 @@ function directory_init(App &$a) {
 }
 
 
-function directory_post(App &$a) {
+function directory_post(App $a) {
        if(x($_POST,'search'))
                $a->data['search'] = $_POST['search'];
 }
 
 
 
-function directory_content(App &$a) {
+function directory_content(App $a) {
        global $db;
 
        require_once("mod/proxy.php");
 
-       if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || 
+       if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) ||
                (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
                return;
@@ -124,7 +124,7 @@ function directory_content(App &$a) {
                        }
 //                     if(strlen($rr['dob'])) {
 //                             if(($years = age($rr['dob'],$rr['timezone'],'')) != 0)
-//                                     $details .= '<br />' . t('Age: ') . $years ; 
+//                                     $details .= '<br />' . t('Age: ') . $years ;
 //                     }
 //                     if(strlen($rr['gender']))
 //                             $details .= '<br />' . t('Gender: ') . $rr['gender'];
index 7eb830bb6896479dd12f0289bbfa60097552cd44..1b19ad92c459e6bad268224fbf2819fc53a7681d 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 require_once('mod/contacts.php');
 
-function dirfind_init(App &$a) {
+function dirfind_init(App $a) {
 
        if (! local_user()) {
                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;
        $discover_user = false;
index c98d936a0f45dd6c01676709d7cf88947406b59c..115feb0ce52c84550b2d7e4b83442dd088e6670d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function display_init(App &$a) {
+function display_init(App $a) {
 
        if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
@@ -194,7 +194,7 @@ function display_fetchauthor($a, $item) {
        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())) {
                notice(t('Public access denied.') . EOL);
index a655801d7727ec11b60837fd3e2fbb4fcc76bc13..2eb427727037082d1d18cb0d0ca0e64b9ae7d31e 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/acl_selectors.php');
 
-function editpost_content(App &$a) {
+function editpost_content(App $a) {
 
        $o = '';
 
index 8281a97661321e797c7afaeafaad305d81f70c5a..4a421df9d977dd251470e4973fc64e3fda04ff09 100644 (file)
@@ -8,7 +8,7 @@ require_once('include/datetime.php');
 require_once('include/event.php');
 require_once('include/items.php');
 
-function events_init(App &$a) {
+function events_init(App $a) {
        if (! local_user()) {
                return;
        }
@@ -31,7 +31,7 @@ function events_init(App &$a) {
        return;
 }
 
-function events_post(App &$a) {
+function events_post(App $a) {
 
        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()) {
                notice( t('Permission denied.') . EOL);
index 9c8d2169bae245080484c5cbffa5c7fd7dde82cb..09ecf032e7a990d4ca054ca6fd44feb5a3bd9164 100644 (file)
@@ -10,7 +10,7 @@ require_once('include/Photo.php');
 /**
  * @param App $a
  */
-function fbrowser_content(App &$a){
+function fbrowser_content(App $a) {
 
        if (!local_user())
                killme();
index 64eac174ac1917ff5ec35aff2c83d39fb4761e5f..3576384f01740a62805f05673b7013c6cc6bb339 100644 (file)
@@ -6,9 +6,7 @@ require_once("include/crypto.php");
 require_once("include/diaspora.php");
 require_once("include/xml.php");
 
-/// @TODO You always make it like this: function foo(&$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){
+function fetch_init(App $a) {
 
        if (($a->argc != 3) OR (!in_array($a->argv[1], array("post", "status_message", "reshare")))) {
                header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
index 1b5589380b288e14a81e774558c1cdd6b767e866..47c4aa5e4cbc6fc05139174415d2f5485a97f7fb 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function filer_content(App &$a) {
+function filer_content(App $a) {
 
        if (! local_user()) {
                killme();
@@ -30,7 +30,7 @@ function filer_content(App &$a) {
                        '$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')),
                        '$submit' => t('Save'),
                ));
-               
+
                echo $o;
        }
        killme();
index 7dbfe29473dd38b02e7c51c9769a9720ed6e106c..7dd7df2f5ad47fadf6d74702732b757866841903 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function filerm_content(App &$a) {
+function filerm_content(App $a) {
 
        if (! local_user()) {
                killme();
index 3ba33780ba944327cd2fa86a6a4ad88fc5c06120..2b564c1bfa2a8b0342ddc6eff9fe5c560d13fa7a 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/follow.php');
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 
-function follow_content(App &$a) {
+function follow_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -152,7 +152,7 @@ function follow_content(App &$a) {
        return $o;
 }
 
-function follow_post(App &$a) {
+function follow_post(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index d79c89a6b24ec9ddb867c7f7cf73434b913ceeb1..3f242f7c56af6ce13ce34b64c9c0296d9093bf81 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function friendica_init(App &$a) {
+function friendica_init(App $a) {
        if ($a->argv[1]=="json"){
                $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 .= '<h3>Friendica</h3>';
@@ -70,7 +70,7 @@ function friendica_content(App &$a) {
        $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
        $o .= t('running at web location') . ' ' . z_root() . '</p><p>';
 
-       $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';        
+       $o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
 
        $o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a></p><p>';
        $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
@@ -102,7 +102,7 @@ function friendica_content(App &$a) {
        else
                $o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';
 
-       call_hooks('about_hook', $o);   
+       call_hooks('about_hook', $o);
 
        return $o;
 
index fcbadcc9b7f06a5febca3ee9167608f429f37086..b3d5439712f5e7e9b9b1410ddee75cc056bf6d1e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function fsuggest_post(App &$a) {
+function fsuggest_post(App $a) {
 
        if (! local_user()) {
                return;
@@ -40,11 +40,11 @@ function fsuggest_post(App &$a) {
                                VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
                                intval(local_user()),
                                intval($contact_id),
-                               dbesc($r[0]['name']), 
-                               dbesc($r[0]['url']), 
-                               dbesc($r[0]['request']), 
-                               dbesc($r[0]['photo']), 
-                               dbesc($hash), 
+                               dbesc($r[0]['name']),
+                               dbesc($r[0]['url']),
+                               dbesc($r[0]['request']),
+                               dbesc($r[0]['photo']),
+                               dbesc($hash),
                                dbesc(datetime_convert())
                        );
                        $r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
@@ -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');
 
@@ -101,7 +101,7 @@ function fsuggest_content(App &$a) {
 
        $o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';
 
-       $o .= contact_selector('suggest','suggest-select', false, 
+       $o .= contact_selector('suggest','suggest-select', false,
                array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));
 
 
index 681bc88cc3176af4f4f3b3c406787a9a41b379b5..2b332e401f09debcbd987e2f80cb15c794bcb841 100644 (file)
@@ -4,7 +4,7 @@ function validate_members(&$item) {
        $item = intval($item);
 }
 
-function group_init(App &$a) {
+function group_init(App $a) {
        if(local_user()) {
                require_once('include/group.php');
                $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()) {
                notice( t('Permission denied.') . EOL);
@@ -69,7 +69,7 @@ function group_post(App &$a) {
        return;
 }
 
-function group_content(App &$a) {
+function group_content(App $a) {
        $change = false;
 
        if (! local_user()) {
index d53405009a6fda34ebadaf3e447c605223c76134..07eb291510653b3d4fd1add4e7b413bba2315dc8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function hcard_init(App &$a) {
+function hcard_init(App $a) {
 
        $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
 
index c2693dedba57103e318f59d50cbaf135e28c99ef..c380aa39138267de91eca27a5c2919e3d5f36fab 100644 (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');
 
index ed66bad147470f3ca0857d41d5e094e3b110447c..b1708d80a2f02e36fe78b650841581508323a316 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 if(! function_exists('home_init')) {
-function home_init(App &$a) {
+function home_init(App $a) {
 
        $ret = array();
        call_hooks('home_init',$ret);
@@ -17,7 +17,7 @@ function home_init(App &$a) {
 }}
 
 if(! function_exists('home_content')) {
-function home_content(App &$a) {
+function home_content(App $a) {
 
        $o = '';
 
index d41d8448050b7befb8e670f2a2302b14f46edaae..27dc349db2df12977e428b9cedee672be9e8b281 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/crypto.php');
 
-function hostxrd_init(App &$a) {
+function hostxrd_init(App $a) {
        header('Access-Control-Allow-Origin: *');
        header("Content-type: text/xml");
        $pubkey = get_config('system','site_pubkey');
index 3371233a34f2088a66e6c143b2ed920bf89a10fb..60e5dee64361356ac0388ba62b40ab18768f8851 100644 (file)
@@ -182,11 +182,11 @@ function photos_post(App $a) {
                        return; // NOTREACHED
                }
 
-               $r = qu("SELECT count(*) FROM `photo` WHERE `album` = '%s' AND `uid` = %d",
+               $r = qu("SELECT `album` FROM `photo` WHERE `album` = '%s' AND `uid` = %d",
                        dbesc($album),
                        intval($page_owner_uid)
                );
-               if (! dbm::is_result($r)) {
+               if (!dbm::is_result($r)) {
                        notice( t('Album not found.') . EOL);
                        goaway($_SESSION['photo_return']);
                        return; // NOTREACHED
@@ -818,22 +818,23 @@ function photos_post(App $a) {
        $imagedata = @file_get_contents($src);
 
 
-
-       $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
-               intval($a->data['user']['uid'])
-       );
-
        $limit = service_class_fetch($a->data['user']['uid'],'photo_upload_limit');
 
-       if (($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
-               notice( upgrade_message() . EOL );
-               @unlink($src);
-               $foo = 0;
-               call_hooks('photo_post_end',$foo);
-               killme();
+       if ($limit) {
+               $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
+                       intval($a->data['user']['uid'])
+               );
+               $size = $r[0]['total'];
+
+               if (($size + strlen($imagedata)) > $limit) {
+                       notice( upgrade_message() . EOL );
+                       @unlink($src);
+                       $foo = 0;
+                       call_hooks('photo_post_end',$foo);
+                       killme();
+               }
        }
 
-
        $ph = new Photo($imagedata, $type);
 
        if (! $ph->is_valid()) {
index bf2f20d2a9bb63c2d403e78098a3eb06b78d1a00..abc9dda5560e1bdd5d54fea48c5326ae5c473ace 100644 (file)
@@ -2,7 +2,7 @@
 require_once("include/Contact.php");
 require_once('include/Probe.php');
 
-function profiles_init(App &$a) {
+function profiles_init(App $a) {
 
        nav_set_selected('profiles');
 
@@ -160,7 +160,7 @@ function profile_clean_keywords($keywords) {
        return $keywords;
 }
 
-function profiles_post(App &$a) {
+function profiles_post(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -601,7 +601,7 @@ function profile_activity($changed, $value) {
 }
 
 
-function profiles_content(App &$a) {
+function profiles_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index bbb055b021c382e639dd5e50d20cb5b29419bd70..a414d8947bf35369a819b9966239585468889b59 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function profperm_init(App &$a) {
+function profperm_init(App $a) {
 
        if (! local_user()) {
                return;
@@ -14,7 +14,7 @@ function profperm_init(App &$a) {
 }
 
 
-function profperm_content(App &$a) {
+function profperm_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied') . EOL);
@@ -109,9 +109,9 @@ function profperm_content(App &$a) {
        }
 
        $o .= '<div id="prof-update-wrapper">';
-       if($change) 
+       if($change)
                $o = '';
-       
+
        $o .= '<div id="prof-members-title">';
        $o .= '<h3>' . t('Visible To') . '</h3>';
        $o .= '</div>';
index 308e237d5d55bbebe91e12e36a927184bfaf6177..2ba1958a25050cbce35e075d04d6081aa5d71907 100644 (file)
@@ -26,7 +26,7 @@ function hub_post_return() {
 
 
 
-function pubsub_init(App &$a) {
+function pubsub_init(App $a) {
 
        $nick       = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
        $contact_id = (($a->argc > 2) ? intval($a->argv[2])       : 0 );
@@ -57,7 +57,7 @@ function pubsub_init(App &$a) {
 
                $sql_extra = ((strlen($hub_verify)) ? sprintf(" AND `hub-verify` = '%s' ", dbesc($hub_verify)) : '');
 
-               $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d 
+               $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d
                        AND `blocked` = 0 AND `pending` = 0 $sql_extra LIMIT 1",
                        intval($contact_id),
                        intval($owner['uid'])
@@ -75,7 +75,7 @@ function pubsub_init(App &$a) {
 
                $contact = $r[0];
 
-               // We must initiate an unsubscribe request with a verify_token. 
+               // We must initiate an unsubscribe request with a verify_token.
                // Don't allow outsiders to unsubscribe us.
 
                if($hub_mode === 'unsubscribe') {
@@ -98,7 +98,7 @@ function pubsub_init(App &$a) {
 
 require_once('include/security.php');
 
-function pubsub_post(App &$a) {
+function pubsub_post(App $a) {
 
        $xml = file_get_contents('php://input');
 
index a6c36631aefa5fb77a6d383d2a39d1cff23156f3..dceb16ae1f260cf9415e9e7378e54582a35ee182 100644 (file)
@@ -4,7 +4,7 @@ function post_var($name) {
        return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
 }
 
-function pubsubhubbub_init(App &$a) {
+function pubsubhubbub_init(App $a) {
        // PuSH subscription must be considered "public" so just block it
        // if public access isn't enabled.
        if (get_config('system', 'block_public')) {
index 118c93d9fa31a3d75d8508237a2f3869beed27e8..8512bea51e622aaf52ed1dd4d210b4f3815867dc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function qsearch_init(App &$a) {
+function qsearch_init(App $a) {
 
        if (! local_user()) {
                killme();
index 08157a3851a40ff8bba7723112498a817c90de21..d8cffb380ccd46de6552fb72b12cd576b45de058 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function randprof_init(App &$a) {
+function randprof_init(App $a) {
        require_once('include/Contact.php');
 
        $x = random_profile();
index ec46ee742e24d3268d19f0cf68cc8d371c40b8e1..3563f2d705a487f23b7a3b3652bdf308957f62bb 100644 (file)
@@ -10,7 +10,7 @@ require_once('include/crypto.php');
 require_once('include/diaspora.php');
 
 
-function receive_post(App &$a) {
+function receive_post(App $a) {
 
 
        $enabled = intval(get_config('system','diaspora_enabled'));
index e951b2d2a9871251c7256ccff4b7f60b8c5e7206..12f53900a7528c8826788aad408b384c23f4d176 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function redir_init(App &$a) {
+function redir_init(App $a) {
 
        $url = ((x($_GET,'url')) ? $_GET['url'] : '');
        $quiet = ((x($_GET,'quiet')) ? '&quiet=1' : '');
@@ -57,9 +57,9 @@ function redir_init(App &$a) {
                        intval(time() + 45)
                );
 
-               logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG); 
+               logger('mod_redir: ' . $r[0]['name'] . ' ' . $sec, LOGGER_DEBUG);
                $dest = (($url) ? '&destination_url=' . $url : '');
-               goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id 
+               goaway ($r[0]['poll'] . '?dfrn_id=' . $dfrn_id
                        . '&dfrn_version=' . DFRN_PROTOCOL_VERSION . '&type=profile&sec=' . $sec . $dest . $quiet );
        }
 
index dd953de35619119cb7a7d898a4e11f974bec9452..81e8c3ad83927c03bd06fdc6a175eadf7d7c6838 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/user.php');
 
 if(! function_exists('register_post')) {
-function register_post(App &$a) {
+function register_post(App $a) {
 
        global $lang;
 
@@ -172,7 +172,7 @@ function register_post(App &$a) {
 
 
 if(! function_exists('register_content')) {
-function register_content(App &$a) {
+function register_content(App $a) {
 
        // logged in users can register others (people/pages/groups)
        // even with closed registrations, unless specifically prohibited by site policy.
index 44bdfe66449029aa9bc1b6380afcb44f8ff6fa10..1983ca0899ddbf0608b43bcccb601046c355d44b 100644 (file)
@@ -97,7 +97,7 @@ function user_deny($hash) {
 
 }
 
-function regmod_content(App &$a) {
+function regmod_content(App $a) {
 
        global $lang;
 
index 4257667c4b1bf663325cbc2e4fdbe1950a2456a9..40033624d8889ac330a8be2c7f725febef8e2cfc 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function removeme_post(App &$a) {
+function removeme_post(App $a) {
 
        if (! local_user()) {
                return;
@@ -32,7 +32,7 @@ function removeme_post(App &$a) {
 
 }
 
-function removeme_content(App &$a) {
+function removeme_content(App $a) {
 
        if (! local_user()) {
                goaway(z_root());
index 07721220a087150f14a42bedb3d60235381e4c4e..3e9130e0e8e42a233b5bd5090a383adc3ff599ff 100755 (executable)
@@ -3,7 +3,7 @@
 require_once('include/Scrape.php');
 require_once('include/follow.php');
 
-function repair_ostatus_content(App &$a) {
+function repair_ostatus_content(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 13c84c3fcc47049e4367803bc12590d768488c80..3b74a143df7d9b32394b81f92d73ce4b2f1ebf85 100644 (file)
@@ -2,7 +2,7 @@
 
 
 
-function rsd_xml_content(App &$a) {
+function rsd_xml_content(App $a) {
        header ("Content-Type: text/xml");
        echo '<?xml version="1.0" encoding="UTF-8"?>
  <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
index 6c3aea211447f4676229f349cd9352dca1be3cfb..69809f5234fe9007ac4f979039a48f6d242a0d7b 100644 (file)
@@ -19,7 +19,7 @@ function salmon_return($val) {
 
 }
 
-function salmon_post(App &$a) {
+function salmon_post(App $a) {
 
        $xml = file_get_contents('php://input');
 
@@ -156,7 +156,7 @@ function salmon_post(App &$a) {
                if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
                        $result = new_contact($importer['uid'],$author_link);
                        if($result['success']) {
-                               $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s') 
+                               $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s')
                                        AND `uid` = %d LIMIT 1",
                                        dbesc(NETWORK_OSTATUS),
                                        dbesc($author_link),
index 22879f7f9e6aea569db9d61fe493ca1b7c864bf6..df604e367c7724a46118dec997da42e1183b5fce 100644 (file)
@@ -43,7 +43,7 @@ function search_saved_searches() {
 }
 
 
-function search_init(App &$a) {
+function search_init(App $a) {
 
        $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
 
@@ -81,13 +81,13 @@ function search_init(App &$a) {
 
 
 
-function search_post(App &$a) {
+function search_post(App $a) {
        if(x($_POST,'search'))
                $a->data['search'] = $_POST['search'];
 }
 
 
-function search_content(App &$a) {
+function search_content(App $a) {
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
index 22c855edba6dcd0168608e98ff69f1889c2dbc5e..a73bcc78fabce3938c021534d5c20c8e52f03873 100644 (file)
@@ -1,5 +1,5 @@
 <?php
 
-function session_content(&$a) {
+function session_content(App $a) {
 
 }
index 1fbd24325d14d23bed3b66e5483e7709d7520532..32ccaf541af0aa738469642a3274049b6d6f1d06 100644 (file)
@@ -16,7 +16,7 @@ function get_theme_config_file($theme){
        return null;
 }
 
-function settings_init(App &$a) {
+function settings_init(App $a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL );
@@ -116,7 +116,7 @@ function settings_init(App &$a) {
 }
 
 
-function settings_post(App &$a) {
+function settings_post(App $a) {
 
        if (! local_user()) {
                return;
@@ -654,7 +654,7 @@ function settings_post(App &$a) {
 }
 
 
-function settings_content(App &$a) {
+function settings_content(App $a) {
 
        $o = '';
        nav_set_selected('settings');
index f2e016708fef321a74937e3c8c9be93e5ba87401..928ccdef263efc45b7f24f66c6c8c123f945888a 100644 (file)
@@ -1,12 +1,12 @@
 <?php
-function share_init(App &$a) {
+function share_init(App $a) {
 
        $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
        if((! $post_id) || (! local_user()))
                killme();
 
-       $r = q("SELECT item.*, contact.network FROM `item` 
-               inner join contact on `item`.`contact-id` = `contact`.`id` 
+       $r = q("SELECT item.*, contact.network FROM `item`
+               inner join contact on `item`.`contact-id` = `contact`.`id`
                WHERE `item`.`id` = %d AND `item`.`uid` = %d LIMIT 1",
 
                intval($post_id),
index 8e04d5d054497ef2b42cb3c742b52b9cdbaba82a..4d8ab6bcaa55fcdb3dbd2d1929efc01a8296fd63 100644 (file)
@@ -6,7 +6,7 @@
 
 require_once("include/Smilies.php");
 
-function smilies_content(App &$a) {
+function smilies_content(App $a) {
        if ($a->argv[1]==="json"){
                $tmp = Smilies::get_list();
                $results = array();
index c23b07b8b595b22757b0fd1a0c7f31f4eed5ac3c..46d3fcff66835644c0b802bfb98db8a8d3a06edf 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function starred_init(App &$a) {
+function starred_init(App $a) {
 
        require_once("include/threads.php");
 
index 2f2adaafe7980c40e564bfc7e8499bae4a2e3af8..07444d2bb525f7facb01e51ba9f77ce6146fde7d 100644 (file)
@@ -5,7 +5,7 @@
 
 require_once("include/plugin.php");
 
-function statistics_json_init(App &$a) {
+function statistics_json_init(App $a) {
 
         if (!get_config("system", "nodeinfo")) {
                 http_status_exit(404);
index c689f7f6cb57c50e089212e12cc784a8b3aba53a..646a4230c5f486819100624ddf754231b52814d1 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function subthread_content(App &$a) {
+function subthread_content(App $a) {
 
        if(! local_user() && ! remote_user()) {
                return;
@@ -49,7 +49,7 @@ function subthread_content(App &$a) {
                }
        }
 
-       // this represents the post owner on this system. 
+       // this represents the post owner on this system.
 
        $r = q("SELECT `contact`.*, `user`.`nickname` FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
                WHERE `contact`.`self` = 1 AND `contact`.`uid` = %d LIMIT 1",
index a6c4b6e5680219e549e0391048b0190c8d2b7634..dd24fc0a2a3a01a120557f7bf659d638c30440cf 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/socgraph.php');
 require_once('include/contact_widgets.php');
 
-function suggest_init(App &$a) {
+function suggest_init(App $a) {
        if (! local_user()) {
                return;
        }
@@ -49,7 +49,7 @@ function suggest_init(App &$a) {
 
 
 
-function suggest_content(App &$a) {
+function suggest_content(App $a) {
 
        require_once("mod/proxy.php");
 
index da5c4700f95a69a5adde0f87fd0f57c24ff3f9b1..50099ac69ca4e85627748c6b30736a3d4f4f5b32 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function tagger_content(App &$a) {
+function tagger_content(App $a) {
 
        if(! local_user() && ! remote_user()) {
                return;
index 2a9a26e37bfd4ead658a459076ae082abfa8f4c9..2e7f8b97082436e8061998997f0150d666147fcb 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/bbcode.php');
 
-function tagrm_post(App &$a) {
+function tagrm_post(App $a) {
 
        if (! local_user()) {
                goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
@@ -42,14 +42,14 @@ function tagrm_post(App &$a) {
 
        info( t('Tag removed') . EOL );
        goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
-       
+
        // NOTREACHED
 
 }
 
 
 
-function tagrm_content(App &$a) {
+function tagrm_content(App $a) {
 
        $o = '';
 
index 89b73cd4484db62294a05c51724fee32f235f802..f858d8913e9c26fc2cea16a967439ca139560bf9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function toggle_mobile_init(App &$a) {
+function toggle_mobile_init(App $a) {
 
        if (isset($_GET['off'])) {
                $_SESSION['show-mobile'] = false;
index 1ca046d22498860c323d3b1fc587ebf4c0bd0ff4..d886e13b27f115d06d8538854e83592cfa1c72b8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function uexport_init(App &$a){
+function uexport_init(App $a) {
        if (! local_user()) {
                killme();
        }
@@ -10,7 +10,7 @@ function uexport_init(App &$a){
 }
 
 /// @TODO Change space -> tab where wanted
-function uexport_content(App &$a){
+function uexport_content(App $a) {
 
     if ($a->argc > 1) {
         header("Content-type: application/json");
@@ -124,7 +124,7 @@ function uexport_account($a){
 /**
  * echoes account data and items as separated json, one per line
  */
-function uexport_all(App &$a) {
+function uexport_all(App $a) {
 
        uexport_account($a);
        echo "\n";
index 15bc8322b97fdd3337c0293580e0f64cea59101a..e9934393e8a29e41435d32453f709124bbd872a0 100644 (file)
@@ -6,7 +6,7 @@
 \r
 require_once("include/uimport.php");\r
 \r
-function uimport_post(App &$a) {\r
+function uimport_post(App $a) {\r
        switch($a->config['register_policy']) {\r
         case REGISTER_OPEN:\r
             $blocked = 0;\r
@@ -28,7 +28,7 @@ function uimport_post(App &$a) {
             $verified = 0;\r
             break;\r
        }\r
-    \r
+\r
     if (x($_FILES,'accountfile')){\r
         /// @TODO Pass $blocked / $verified, send email to admin on REGISTER_APPROVE\r
         import_account($a, $_FILES['accountfile']);\r
@@ -36,8 +36,8 @@ function uimport_post(App &$a) {
     }\r
 }\r
 \r
-function uimport_content(App &$a) {\r
-       \r
+function uimport_content(App $a) {\r
+\r
        if((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
                notice("Permission denied." . EOL);\r
                return;\r
@@ -52,8 +52,8 @@ function uimport_content(App &$a) {
                        return;\r
                }\r
        }\r
-       \r
-       \r
+\r
+\r
        if(x($_SESSION,'theme'))\r
                unset($_SESSION['theme']);\r
        if(x($_SESSION,'mobile-theme'))\r
index 179e9c61c4d991fdb457803a963caf027c98022e..9a39489dcfb822a39143b235b506a0d8c3905fec 100644 (file)
@@ -4,7 +4,7 @@
 
 require_once("mod/community.php");
 
-function update_community_content(App &$a) {
+function update_community_content(App $a) {
 
        header("Content-type: text/html");
        echo "<!DOCTYPE html><html><body>\r\n";
index 230bbaa0b460d20cdabfb28e4ce5760f7a9b8019..86f4db8259f83c4db9fdd580666c91da42060c16 100644 (file)
@@ -5,7 +5,7 @@
 require_once("mod/display.php");
 require_once("include/group.php");
 
-function update_display_content(App &$a) {
+function update_display_content(App $a) {
 
        $profile_uid = intval($_GET["p"]);
 
index c6d33132cc7557d33eae48a3681c0f8ac713efce..869973ace4f07af1b8c2750103849a36f6f85f5d 100644 (file)
@@ -5,7 +5,7 @@
 require_once("mod/network.php");
 require_once("include/group.php");
 
-function update_network_content(App &$a) {
+function update_network_content(App $a) {
 
        $profile_uid = intval($_GET["p"]);
 
index b21f698054b9fa3d92f9bdd2ba1ae2280ff5517e..d27cc4ca9672bfcfe1007b2289bfd9bcb14dc71c 100644 (file)
@@ -7,7 +7,7 @@
 
 require_once("mod/notes.php");
 
-function update_notes_content(App &$a) {
+function update_notes_content(App $a) {
 
        $profile_uid = intval($_GET["p"]);
 
index e16b0b5cccbe58126ca678c126aaefeba60ce7f7..b77a9cdcfc5e4d40755c38bb22172364f9cdb7fb 100644 (file)
@@ -7,7 +7,7 @@
 
 require_once("mod/profile.php");
 
-function update_profile_content(App &$a) {
+function update_profile_content(App $a) {
 
        $profile_uid = intval($_GET["p"]);
 
index 433ce5fc63f82e2e150b7b7c9ce87325553ba50e..3828b8f1fefb649df1a5973261639dac46636b10 100644 (file)
@@ -6,7 +6,7 @@ require_once('include/security.php');
 require_once('include/redir.php');
 
 
-function videos_init(App &$a) {
+function videos_init(App $a) {
 
        if($a->argc > 1)
                auto_redir($a, $a->argv[1]);
@@ -102,7 +102,7 @@ function videos_init(App &$a) {
 
 
 
-function videos_post(App &$a) {
+function videos_post(App $a) {
 
        $owner_uid = $a->data['user']['uid'];
 
@@ -182,7 +182,7 @@ function videos_post(App &$a) {
 
 
 
-function videos_content(App &$a) {
+function videos_content(App $a) {
 
        // URLs (most aren't currently implemented):
        // videos/name
index 9c72a46e9c7c2437ea41784c0e16696f819a6d91..55afda9b635f0840597e18423709b33a756e4b15 100644 (file)
@@ -2,7 +2,7 @@
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 
-function viewcontacts_init(App &$a) {
+function viewcontacts_init(App $a) {
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
@@ -29,7 +29,7 @@ function viewcontacts_init(App &$a) {
 }
 
 
-function viewcontacts_content(App &$a) {
+function viewcontacts_content(App $a) {
        require_once("mod/proxy.php");
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
index 8510bd539573ac72ebbd07b1636b53ad06bb61ce..a3f0affb531971cfc1eb63e06fd02d073ce34b74 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function viewsrc_content(App &$a) {
+function viewsrc_content(App $a) {
 
        if (! local_user()) {
                notice( t('Access denied.') . EOL);
@@ -16,7 +16,7 @@ function viewsrc_content(App &$a) {
                return;
        }
 
-       $r = q("SELECT `item`.`body` FROM `item` 
+       $r = q("SELECT `item`.`body` FROM `item`
                WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
                and `item`.`moderated` = 0
                AND `item`.`id` = '%s' LIMIT 1",
index 18125685450c4760929ce37f90926f69f16a4a94..0fc8b8a6a3aae79a60dc1bf70459de1bde6bed01 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/attach.php');
 require_once('include/datetime.php');
 
-function wall_attach_post(App &$a) {
+function wall_attach_post(App $a) {
 
        $r_json = (x($_GET,'response') && $_GET['response']=='json');
 
@@ -112,24 +112,26 @@ function wall_attach_post(App &$a) {
                killme();
        }
 
-       $r = q("select sum(octet_length(data)) as total from attach where uid = %d ",
-               intval($page_owner_uid)
-       );
-
        $limit = service_class_fetch($page_owner_uid,'attach_upload_limit');
 
-       if(($limit !== false) && (($r[0]['total'] + strlen($imagedata)) > $limit)) {
-               $msg = upgrade_message(true);
-               if ($r_json) {
-                       echo json_encode(array('error'=>$msg));
-               } else {
-                       echo  $msg. EOL ;
+        if ($limit) {
+               $r = q("select sum(octet_length(data)) as total from photo where uid = %d and scale = 0 and album != 'Contact Photos' ",
+                       intval($page_owner_uid)
+               );
+               $size = $r[0]['total'];
+
+               if (($size + strlen($imagedata)) > $limit) {
+                       $msg = upgrade_message(true);
+                       if ($r_json) {
+                               echo json_encode(array('error'=>$msg));
+                       } else {
+                               echo  $msg. EOL ;
+                       }
+                       @unlink($src);
+                       killme();
                }
-               @unlink($src);
-               killme();
        }
 
-
        $filedata = @file_get_contents($src);
        $mimetype = z_mime_content_type($filename);
        $hash = get_guid(64);
index eb2a92323ab0115b489e92bb371039d02b17e0f6..82cd3652b3f2549a4b24063eaeaba94a60ed447e 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/Photo.php');
 
-function wall_upload_post(&$a, $desktopmode = true) {
+function wall_upload_post(App $a, $desktopmode = true) {
 
        logger("wall upload: starting new upload", LOGGER_DEBUG);
 
@@ -166,21 +166,19 @@ function wall_upload_post(&$a, $desktopmode = true) {
                        intval($page_owner_uid)
                );
                $size = $r[0]['total'];
-       } else
-               $size = 0;
 
-       if(($limit !== false) && (($size + strlen($imagedata)) > $limit)) {
-               $msg = upgrade_message(true);
-               if ($r_json) {
-                       echo json_encode(array('error'=>$msg));
-               } else {
-                       echo  $msg. EOL;
+               if (($size + strlen($imagedata)) > $limit) {
+                       $msg = upgrade_message(true);
+                       if ($r_json) {
+                               echo json_encode(array('error'=>$msg));
+                       } else {
+                               echo  $msg. EOL;
+                       }
+                       @unlink($src);
+                       killme();
                }
-               @unlink($src);
-               killme();
        }
 
-
        $imagedata = @file_get_contents($src);
        $ph = new Photo($imagedata, $filetype);
 
index e0c702cdb0ca45abfcb9e1cdd96e405c058325a1..c0a30bdcf4cc8efc0811cc4c2ffbe8e1052dff78 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/message.php');
 
-function wallmessage_post(App &$a) {
+function wallmessage_post(App $a) {
 
        $replyto = get_my_url();
        if(! $replyto) {
@@ -73,7 +73,7 @@ function wallmessage_post(App &$a) {
 }
 
 
-function wallmessage_content(App &$a) {
+function wallmessage_content(App $a) {
 
        if(! get_my_url()) {
                notice( t('Permission denied.') . EOL);
@@ -134,9 +134,9 @@ function wallmessage_content(App &$a) {
                '$nickname' => $user['nickname'],
                '$linkurl' => t('Please enter a link URL:')
        ));
-       
 
-       
+
+
        $tpl = get_markup_template('wallmessage.tpl');
        $o .= replace_macros($tpl,array(
                '$header' => t('Send Private Message'),
index f08451ba70446d380b75170c04272f721594d13e..eee0580e3178c8b8a492ecf73fcbd1c718bb82fa 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once("include/Probe.php");
 
-function webfinger_content(App &$a) {
+function webfinger_content(App $a) {
 
        $o .= '<h3>Webfinger Diagnostic</h3>';
 
index a56c7fbdffaa0503a971fd3891a6de7b76960e28..7b812a7f9d94610d804515ba2e454cdf855762b0 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/crypto.php');
 
-function xrd_init(App &$a) {
+function xrd_init(App $a) {
 
        $uri = urldecode(notags(trim($_GET['uri'])));
 
index 3bd9cbe610efa77aae3f5b045f510c79069bf3fd..058536d82195421998d75b4069f0515af15917ec 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define('UPDATE_VERSION' , 1211);
+define('UPDATE_VERSION' , 1212);
 
 /**
  *
index 48c9c8709918fc7ab6d0915d62e5bb499f67c453..381b0671676fe1a5fd9e86f9bde8f33aa79bcd8b 100644 (file)
@@ -3,7 +3,7 @@
  * Theme settings
  */
 
-function theme_content(App &$a){
+function theme_content(App $a) {
        if (!local_user()) {
                return;
        }
@@ -14,7 +14,7 @@ function theme_content(App &$a){
        return clean_form($a, $colorset, $user);
 }
 
-function theme_post(App &$a){
+function theme_post(App $a) {
        if (! local_user()) {
                return;
        }
@@ -24,23 +24,23 @@ function theme_post(App &$a){
        }
 }
 
-function theme_admin(App &$a){
+function theme_admin(App $a) {
        $colorset = get_config( 'duepuntozero', 'colorset');
        $user = false;
 
        return clean_form($a, $colorset, $user);
 }
 
-function theme_admin_post(App &$a){
+function theme_admin_post(App $a) {
        if (isset($_POST['duepuntozero-settings-submit'])){
                set_config('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
        }
 }
 
 /// @TODO $a is no longer used
-function clean_form(&$a, &$colorset, $user){
+function clean_form(App $a, &$colorset, $user) {
        $colorset = array(
-               'default'     =>t('default'), 
+               'default'     =>t('default'),
                'greenzero'   =>t('greenzero'),
                'purplezero'  =>t('purplezero'),
                'easterbunny' =>t('easterbunny'),
index bf1d031def9367c1d5128315313fab16e1ab1c66..7d3c22469fba8d09996350d580099c2834fc08d6 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function duepuntozero_init(App &$a) {
+function duepuntozero_init(App $a) {
 
 set_template_engine($a, 'smarty3');
 
@@ -24,7 +24,7 @@ set_template_engine($a, 'smarty3');
 $a->page['htmlhead'] .= <<< EOT
 <script>
 function insertFormatting(comment,BBcode,id) {
-       
+
                var tmpStr = $("#comment-edit-text-" + id).val();
                if(tmpStr == comment) {
                        tmpStr = "";
@@ -40,7 +40,7 @@ function insertFormatting(comment,BBcode,id) {
                selected = document.selection.createRange();
                if (BBcode == "url"){
                        selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
-                       } else                  
+                       } else
                selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
        } else if (textarea.selectionStart || textarea.selectionStart == "0") {
                var start = textarea.selectionStart;
index 000ef26092fa43330d1dcdda24489ade8980f3f6..57e88265721a27a3814b541510a72827769801a8 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once('view/theme/frio/php/Image.php');
 
-function theme_content(App &$a) {
+function theme_content(App $a) {
        if (!local_user()) {
                return;
        }
@@ -16,10 +16,10 @@ function theme_content(App &$a) {
        $arr["background_image"] = get_pconfig(local_user(),'frio', 'background_image' );
        $arr["bg_image_option"] = get_pconfig(local_user(),'frio', 'bg_image_option' );
 
-       return frio_form($a, $arr);
+       return frio_form($arr);
 }
 
-function theme_post(App &$a) {
+function theme_post(App $a) {
        if (!local_user()) {
                return;
        }
@@ -36,9 +36,9 @@ function theme_post(App &$a) {
        }
 }
 
-function frio_form(&$a, $arr) {
+function frio_form($arr) {
        require_once("view/theme/frio/php/schema.php");
-       
+
        $scheme_info = get_schema_info($arr["schema"]);
        $disable = $scheme_info["overwrites"];
        if (!is_array($disable)) $disable = array();
index 0e221f5337db55a38c6f9623128824b332a9e13d..59a246bf99647cf53ad6eca0cb8086923a1b37f6 100644 (file)
@@ -2,18 +2,18 @@
 
 /**
  * @file view/theme/frio/php/frio_boot.php
- * 
+ *
  * @brief This file contains functions for page contstruction
- * 
+ *
  */
 
 
 /**
  * @brief Load page template in dependence of the template mode
- * 
+ *
  * @todo Check if this is really needed.
  */
-function load_page(App &$a) {
+function load_page(App $a) {
        if(isset($_GET["mode"]) AND ($_GET["mode"] == "minimal")) {
                require "view/theme/frio/minimal.php";
        } elseif((isset($_GET["mode"]) AND ($_GET["mode"] == "none"))) {
@@ -27,16 +27,16 @@ function load_page(App &$a) {
                        require_once(str_replace('theme/' . current_theme() . '/', '', $template));
        }
 
-       
+
 }
 
 
 /**
  * @brief Check if page is a modal page
- * 
+ *
  * This function checks if $_REQUEST['pagename'] is
  * a defined in a $modalpages
- * 
+ *
  * @return bool
  */
 function is_modal() {
@@ -48,16 +48,16 @@ function is_modal() {
                        $is_modal = true;
                }
        }
-       
+
        return $is_modal;
 }
 
 /**
  * @brief Array with modalpages
- * 
+ *
  * The array contains the page names of the pages
  * which should displayed as modals
- * 
+ *
  * @return array Pagenames as path
  */
 function get_modalpage_list() {
@@ -74,10 +74,10 @@ function get_modalpage_list() {
 
 /**
  * @brief Array with standard pages
- * 
+ *
  * The array contains the page names of the pages
  * which should displayed as standard-page
- * 
+ *
  * @return array Pagenames as path
  */
 function get_standard_page_list() {
@@ -91,10 +91,10 @@ function get_standard_page_list() {
 
 /**
  * @brief Check if page is standard page
- * 
+ *
  * This function checks if $_REQUEST['pagename'] is
  * a defined $standardpages
- * 
+ *
  * @param string $pagetitle Title of the actual page
  * @return bool
  */
@@ -107,12 +107,12 @@ function is_standard_page($pagetitle) {
                        $is_standard_page = true;
                }
        }
-       
+
        return $is_standard_page;
 }
 /**
  * @brief Get the typ of the page
- * 
+ *
  * @param type $pagetitle
  * @return string
  */
index f9cbf79a6ab7939f2ceb31574d391baec99b3f70..d8b10c4e3efe523bb083c633986594876bd638a7 100644 (file)
@@ -4,14 +4,14 @@
  * Description: Bootstrap V3 theme. The theme is currently under construction, so it is far from finished. For further information have a look at the <a href="https://github.com/friendica/friendica/tree/develop/view/theme/frio/README.md">ReadMe</a>.
  * Version: V.0.7
  * Author: Rabuzarus <https://friendica.kommune4.de/profile/rabuzarus>
- * 
+ *
  */
 
 $frio = "view/theme/frio";
 
 global $frio;
 
-function frio_init(App &$a) {
+function frio_init(App $a) {
 
        // disable the events module link in the profile tab
        $a->theme_events_in_profile = false;
@@ -63,18 +63,18 @@ function frio_uninstall() {
        logger("uninstalled theme frio");
 }
 /**
- * @brief Replace friendica photo links
- * 
+ * @brief Replace friendica photo links hook
+ *
  *  This function does replace the links to photos
  *  of other friendica users. Original the photos are
  *  linked to the photo page. Now they will linked directly
  *  to the photo file. This function is nessesary to use colorbox
  *  in the network stream
- * 
- * @param App $a
+ *
+ * @param App $a Unused but required by hook definition
  * @param array $body_info The item and its html output
  */
-function frio_item_photo_links(&$a, &$body_info) {
+function frio_item_photo_links(App $a, &$body_info) {
        require_once('include/Photo.php');
 
        $phototypes = Photo::supportedTypes();
@@ -104,16 +104,16 @@ function frio_item_photo_links(&$a, &$body_info) {
 }
 
 /**
- * @brief Replace links of the item_photo_menu
- * 
+ * @brief Replace links of the item_photo_menu hook
+ *
  *  This function replaces the original poke and the message links
  *  to call the addToModal javascript function so this pages can
  *  be loaded in a bootstrap modal
- * 
- * @param app $a The app data
+ *
+ * @param App $a Unused but required by the hook definition
  * @param array $arr Contains item data and the original photo_menu
  */
-function frio_item_photo_menu($a, &$arr){
+function frio_item_photo_menu(App $a, &$arr) {
 
        foreach($arr["menu"] as $k =>$v) {
                if(strpos($v,'poke/?f=&c=') === 0 || strpos($v,'message/new/') === 0) {
@@ -126,17 +126,17 @@ function frio_item_photo_menu($a, &$arr){
 
 /**
  * @brief Replace links of the contact_photo_menu
- * 
+ *
  *  This function replaces the original poke and the message links
  *  to call the addToModal javascript function so this pages can
  *  be loaded in a bootstrap modal
  *  Additionally the profile, status and photo page links  will be changed
  *  to don't open in a new tab if the contact is a friendica contact.
- * 
+ *
  * @param app $a The app data
  * @param array $args Contains contact data and the original photo_menu
  */
-function frio_contact_photo_menu($a, &$args){
+function frio_contact_photo_menu(App $a, &$args){
 
        $pokelink = "";
        $pmlink = "";
@@ -152,7 +152,7 @@ function frio_contact_photo_menu($a, &$args){
        // friendicas "magic-link" which indicates a friendica user on froreign
        // friendica servers as remote user or visitor
        //
-       // The value for opening in a new tab is e.g. when 
+       // The value for opening in a new tab is e.g. when
        // $args["menu"]["status"][2] is true. If the value of the [2] key is true
        // and if it's a friendica contact we set it to false
        foreach($args["menu"] as $k =>$v) {
@@ -176,15 +176,15 @@ function frio_contact_photo_menu($a, &$args){
 
 /**
  * @brief Construct remote nav menu
- * 
+ *
  *  It creates a remote baseurl form $_SESSION for remote users and friendica
- *  visitors. This url will be added to some of the nav links. With this behaviour 
+ *  visitors. This url will be added to some of the nav links. With this behaviour
  *  the user will come back to her/his own pages on his/her friendica server.
  *  Not all possible links are available (notifications, administrator, manage,
  *  notes aren't available because we have no way the check remote permissions)..
  *  Some links will point to the local pages because the user would expect
  *  local page (these pages are: search, community, help, apps, directory).
- * 
+ *
  * @param app $a The App class
  * @param array $nav The original nav menu
  */
@@ -196,11 +196,11 @@ function frio_remote_nav($a,&$nav) {
 
        // split up the url in it's parts (protocol,domain/directory, /profile/, nickname
        // I'm not familiar with regex, so someone might find a better solutionen
-       // 
+       //
        // E.g $homelink = 'https://friendica.domain.com/profile/mickey' should result in an array
        // with 0 => 'https://friendica.domain.com/profile/mickey' 1 => 'https://',
        // 2 => 'friendica.domain.com' 3 => '/profile/' 4 => 'mickey'
-       // 
+       //
        //$server_url = preg_match('/^(https?:\/\/.*?)\/profile\//2', $homelink);
        preg_match('/^(https?:\/\/)?(.*?)(\/profile\/)(.*)/', $homelink, $url_parts);
 
@@ -219,8 +219,8 @@ function frio_remote_nav($a,&$nav) {
                // empty the server url for local user because we won't need it
                $server_url = '';
                // user info
-               $r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self` = 1", intval($a->user['uid']));
-               
+               $r = q("SELECT `micro` FROM `contact` WHERE `uid` = %d AND `self`", intval($a->user['uid']));
+
                $r[0]['photo'] = (dbm::is_result($r) ? $a->remove_baseurl($r[0]['micro']) : "images/person-48.jpg");
                $r[0]['name'] = $a->user['username'];
 
@@ -263,14 +263,14 @@ function frio_remote_nav($a,&$nav) {
 }
 /**
  * @brief: Search for contacts
- * 
+ *
  * This function search for a users contacts. The code is copied from contact search
  * in /mod/contacts.php. With this function the contacts will permitted to acl_lookup()
- * and can grabbed as json. For this we use the type="r". This is usful to to let js 
+ * and can grabbed as json. For this we use the type="r". This is usful to to let js
  * grab the contact data.
  * We use this to give the data to textcomplete and have a filter function at the
  * contact page.
- * 
+ *
  * @param App $a The app data @TODO Unused
  * @param array $results The array with the originals from acl_lookup()
  */
@@ -298,7 +298,7 @@ function frio_acl_lookup($a, &$results) {
 
 
                $r = q("SELECT COUNT(*) AS `total` FROM `contact`
-                       WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 ",
+                       WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra2 ",
                        intval($_SESSION['uid']));
                if (dbm::is_result($r)) {
                        $total = $r[0]["total"];
@@ -306,7 +306,7 @@ function frio_acl_lookup($a, &$results) {
 
                $sql_extra3 = unavailable_networks();
 
-               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT 100 ",
+               $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND NOT `pending` $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT 100 ",
                        intval($_SESSION['uid'])
                );
 
index 4ca592f4c880a5c47c1acb432133401eeaa1eaa4..7e4262cb6a46fc601c7228765405806d7b3cd752 100644 (file)
@@ -9,7 +9,7 @@
  * Maintainer: Zach P <techcity@f.shmuz.in>
  */
 
-function frost_mobile_init(App &$a) {
+function frost_mobile_init(App $a) {
        $a->sourcename = 'Friendica mobile web';
        $a->videowidth = 250;
        $a->videoheight = 200;
@@ -18,7 +18,7 @@ function frost_mobile_init(App &$a) {
        set_template_engine($a, 'smarty3');
 }
 
-function frost_mobile_content_loaded(App &$a) {
+function frost_mobile_content_loaded(App $a) {
 
        // I could do this in style.php, but by having the CSS in a file the browser will cache it,
        // making pages load faster
index 7746109e56df657c50fec7747838ea8184f3cec5..4c22f0a11869664db5a6b58b4b1bfdc172fa0ad3 100644 (file)
@@ -9,14 +9,14 @@
  * Maintainer: Zach P <techcity@f.shmuz.in>
  */
 
-function frost_init(App &$a) {
+function frost_init(App $a) {
        $a->videowidth = 400;
        $a->videoheight = 330;
        $a->theme_thread_allow = false;
        set_template_engine($a, 'smarty3');
 }
 
-function frost_content_loaded(App &$a) {
+function frost_content_loaded(App $a) {
 
        // I could do this in style.php, but by having the CSS in a file the browser will cache it,
        // making pages load faster
@@ -43,7 +43,7 @@ function frost_uninstall() {
        logger("uninstalled theme frost");
 }
 
-function frost_item_photo_links(&$a, &$body_info) {
+function frost_item_photo_links(App $a, &$body_info) {
        require_once('include/Photo.php');
        $phototypes = Photo::supportedTypes();
 
@@ -68,7 +68,7 @@ function frost_item_photo_links(&$a, &$body_info) {
                        $body_info['html'] = str_replace($link, $newlink, $body_info['html']);
 
                }
-               
+
                $p = bb_find_open_close($body_info['html'], "<a", ">", $occurence);
        }
 }
index 6c80afdc22d0a2be1c3468a84b13a4c31b298cbf..5af58a18da612ac9aa98dcec19628c408e7805ce 100644 (file)
@@ -3,7 +3,7 @@
  * Theme settings
  */
 
-function theme_content(App &$a){
+function theme_content(App $a) {
        if (!local_user()) {
                return;
        }
@@ -16,7 +16,7 @@ function theme_content(App &$a){
        return quattro_form($a,$align, $color, $tfs, $pfs);
 }
 
-function theme_post(App &$a){
+function theme_post(App $a) {
        if (! local_user()) {
                return;
        }
@@ -29,7 +29,7 @@ function theme_post(App &$a){
        }
 }
 
-function theme_admin(App &$a){
+function theme_admin(App $a) {
        $align = get_config('quattro', 'align' );
        $color = get_config('quattro', 'color' );
        $tfs = get_config("quattro","tfs");
@@ -38,7 +38,7 @@ function theme_admin(App &$a){
        return quattro_form($a,$align, $color, $tfs, $pfs);
 }
 
-function theme_admin_post(App &$a){
+function theme_admin_post(App $a) {
        if (isset($_POST['quattro-settings-submit'])){
                set_config('quattro', 'align', $_POST['quattro_align']);
                set_config('quattro', 'color', $_POST['quattro_color']);
@@ -48,7 +48,7 @@ function theme_admin_post(App &$a){
 }
 
 /// @TODO $a is no longer used here
-function quattro_form(App &$a, $align, $color, $tfs, $pfs){
+function quattro_form(App $a, $align, $color, $tfs, $pfs) {
        $colors = array(
                "dark"  => "Quattro",
                "lilac" => "Lilac",
index ae8f4f906594b0d73f5dcad03dd78d7af708907e..fc908522a1862144ccdf2f971dc9b77f44367136 100644 (file)
@@ -7,7 +7,7 @@
  * Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
  */
 
-function quattro_init(App &$a) {
+function quattro_init(App $a) {
        $a->page['htmlhead'] .= '<script src="'.App::get_baseurl().'/view/theme/quattro/tinycon.min.js"></script>';
        $a->page['htmlhead'] .= '<script src="'.App::get_baseurl().'/view/theme/quattro/js/quattro.js"></script>';;
 }
index 32c48fffa4bf3b0d19b554861fbd31899d0ec790..7e8744f0d170e307d6fd9d727e7c9da29a90929d 100644 (file)
@@ -10,7 +10,7 @@
  * Screenshot: <a href="screenshot.png">Screenshot</a>
  */
 
-function smoothly_init(App &$a) {
+function smoothly_init(App $a) {
        set_template_engine($a, 'smarty3');
 
        $cssFile = null;
@@ -20,7 +20,7 @@ $a->page['htmlhead'] .= <<< EOT
 
 <script>
 function insertFormatting(comment,BBcode,id) {
-       
+
                var tmpStr = $("#comment-edit-text-" + id).val();
                if(tmpStr == comment) {
                        tmpStr = "";
@@ -36,7 +36,7 @@ function insertFormatting(comment,BBcode,id) {
                selected = document.selection.createRange();
                if (BBcode == "url"){
                        selected.text = "["+BBcode+"]" + "http://" +  selected.text + "[/"+BBcode+"]";
-                       } else                  
+                       } else
                selected.text = "["+BBcode+"]" + selected.text + "[/"+BBcode+"]";
        } else if (textarea.selectionStart || textarea.selectionStart == "0") {
                var start = textarea.selectionStart;
index 5326498908d931bf7130db6d3ab1e6e638d1182f..9fd19e8abae87c847db7a7de3415f7c6234879ec 100644 (file)
@@ -5,7 +5,7 @@
 
 
 
-function theme_content(App &$a){
+function theme_content(App $a) {
        if (!local_user()) {
                return;
        }
@@ -35,7 +35,7 @@ function theme_content(App &$a){
                        $show_services, $show_friends, $show_lastusers);
 }
 
-function theme_post(App &$a){
+function theme_post(App $a) {
        if (! local_user()) {
                return;
        }
@@ -52,7 +52,7 @@ function theme_post(App &$a){
 }
 
 
-function theme_admin(App &$a){
+function theme_admin(App $a) {
 
        if (!function_exists('get_vier_config'))
                return;
@@ -81,7 +81,7 @@ function theme_admin(App &$a){
        return $o;
 }
 
-function theme_admin_post(App &$a){
+function theme_admin_post(App $a) {
        if (isset($_POST['vier-settings-submit'])){
                set_config('vier', 'style', $_POST['vier_style']);
                set_config('vier', 'show_pages', $_POST['vier_show_pages']);
@@ -95,7 +95,7 @@ function theme_admin_post(App &$a){
 }
 
 /// @TODO $a is no longer used
-function vier_form(&$a, $style, $show_pages, $show_profiles, $show_helpers, $show_services, $show_friends, $show_lastusers){
+function vier_form(App $a, $style, $show_pages, $show_profiles, $show_helpers, $show_services, $show_friends, $show_lastusers) {
        $styles = array(
                "plus"=>"Plus",
                "breathe"=>"Breathe",
index 8be91220afcc815f0d468f860e7df5afe5464350..12c588a2447958fbb16ebdffc4bc104734823e72 100644 (file)
@@ -13,7 +13,7 @@ require_once("include/plugin.php");
 require_once("include/socgraph.php");
 require_once("mod/proxy.php");
 
-function vier_init(App &$a) {
+function vier_init(App $a) {
 
        $a->theme_events_in_profile = false;