]> git.mxchange.org Git - friendica.git/commitdiff
Merge remote-tracking branch 'upstream/develop' into develop
authorRoland Häder <roland@mxchange.org>
Fri, 6 Jan 2017 16:10:40 +0000 (17:10 +0100)
committerRoland Häder <roland@mxchange.org>
Fri, 6 Jan 2017 16:10:40 +0000 (17:10 +0100)
161 files changed:
boot.php
doc/Plugins.md
doc/autoloader.md
doc/de/Plugins.md
doc/themes.md
include/Contact.php
include/acl_selectors.php
include/api.php
include/contact_widgets.php
include/cron.php
include/dfrn.php
include/diaspora.php
include/event.php
include/follow.php
include/identity.php
include/items.php
include/like.php
include/nav.php
include/network.php
include/plugin.php
include/poller.php
include/queue.php
include/socgraph.php
include/text.php
include/user.php
library/spam/b8/storage/storage_frndc.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/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/hovercard.php
mod/ignored.php
mod/install.php
mod/invite.php
mod/item.php
mod/like.php
mod/localtime.php
mod/lockview.php
mod/login.php
mod/lostpass.php
mod/maintenance.php
mod/manage.php
mod/match.php
mod/message.php
mod/modexp.php
mod/mood.php
mod/msearch.php
mod/navigation.php
mod/network.php
mod/newmember.php
mod/nodeinfo.php
mod/nogroup.php
mod/noscrape.php
mod/notes.php
mod/notice.php
mod/notifications.php
mod/notify.php
mod/oembed.php
mod/oexchange.php
mod/openid.php
mod/opensearch.php
mod/ostatus_subscribe.php
mod/parse_url.php
mod/photo.php
mod/photos.php
mod/poco.php
mod/poke.php
mod/post.php
mod/pretheme.php
mod/probe.php
mod/profile.php
mod/profile_photo.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/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/wallmessage.php
mod/webfinger.php
mod/xrd.php
object/Item.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

index aad8813766002d0cd265b0eeabb6f5f580ae43c3..dd816270c76e1fc941989666669172a61e33a323 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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(&$a) {
+function check_url(App &$a) {
 
        $url = get_config('system','url');
 
@@ -1562,7 +1562,7 @@ function check_url(&$a) {
 /**
  * @brief Automatic database updates
  */
-function update_db(&$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(&$a) {
+function check_plugins(App &$a) {
 
        $r = q("SELECT * FROM `addon` WHERE `installed` = 1");
        if (dbm::is_result($r))
@@ -2413,7 +2413,8 @@ function get_temppath() {
        return("");
 }
 
-function set_template_engine(&$a, $engine = 'internal') {
+/// @deprecated
+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 49d0665fec9efd2e277816769bd6cfb0b1c09e76..6460fd5a09459bf6fe57f3dcf1fab6403de1b2de 100644 (file)
@@ -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(&$a), which defines and returns the page body content.
-They may also contain plugin_name_post(&$a) which is called before the _content function and typically handles the results of POST forms.
-You may also have plugin_name_init(&$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
 ---
index 947eade23cfa62701ccd2c08051b95fb29419185..25ffd7fe45b77fe36f3f0693e1ac6ffefcacf4ad 100644 (file)
@@ -68,7 +68,7 @@ The code will be something like:
     file: mod/network.php\r
     <?php\r
     \r
-    function network_content(&$a) {\r
+    function network_content(App &$a) {\r
        $itemsmanager = new \Friendica\ItemsManager();\r
        $items = $itemsmanager->getAll();\r
     \r
index 40be4a069596e8c2f1da1fcac70883f9518f9f8d..b2c3f849ffae55ae57ee7fcdc72dca9ed0024dbf 100644 (file)
@@ -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(&$a), welche den Seiteninhalt definiert und zurückgibt.
-Sie können auch plugin_name_post(&$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
-Du kannst ebenso plugin_name_init(&$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
index 0d3c6eb3d6d0106a2e01d930123a8ca6cf557d76..0b8f6cb83dc03aefd95a860b61609488a821c276 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(&$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(&$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(&$a) {
+    function quattro_init(App &$a) {
       $a->theme_info = array();
       set_template_engine($a, 'smarty3');
     }
index b1f63cbdfd883c1938a7c3d359550f0322b50fd4..5d8ccc4529d6e4c4423e56a0e2b83a60e541b260 100644 (file)
@@ -85,7 +85,7 @@ function contact_remove($id) {
 
 function terminate_friendship($user,$self,$contact) {
 
-       /// @TODO Get rid of this, include/datetime.php should care about by itself
+       /// @TODO Get rid of this, include/datetime.php should care about it by itself
        $a = get_app();
 
        require_once('include/datetime.php');
@@ -226,14 +226,14 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
                        dbesc(normalise_link($url)), intval($uid));
 
        // Fetch the data from the contact table with "uid=0" (which is filled automatically)
-       if (!$r)
+       if (!dbm::is_result($r))
                $r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, `xmpp`,
                        `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `contact-type`, `bd` AS `birthday`, 0 AS `self`
                        FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
                                dbesc(normalise_link($url)));
 
        // Fetch the data from the gcontact table
-       if (!$r)
+       if (!dbm::is_result($r))
                $r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`, '' AS `xmpp`,
                        `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `contact-type`, `birthday`, 0 AS `self`
                        FROM `gcontact` WHERE `nurl` = '%s'",
index a20775379707d68b1416618bbaa1760bc19ed8df..f6c4f947edc4ff5e724fbda2d38da9beb6a7b09c 100644 (file)
@@ -272,7 +272,7 @@ function prune_deadguys($arr) {
 
        $r = q("SELECT `id` FROM `contact` WHERE `id` IN ( " . $str . ") AND `blocked` = 0 AND `pending` = 0 AND `archive` = 0 ");
 
-       if ($r) {
+       if (dbm::is_result($r)) {
                $ret = array();
                foreach ($r as $rr) {
                        $ret[] = intval($rr['id']);
@@ -585,9 +585,9 @@ function acl_lookup(&$a, $out_type = 'json') {
                );
                echo json_encode($o);
                killme();
-       }
-       else
+       } else {
                $r = array();
+       }
 
 
        if (dbm::is_result($r)) {
@@ -691,7 +691,7 @@ function acl_lookup(&$a, $out_type = 'json') {
  * @param App $a
  * @return array with the search results
  */
-function navbar_complete(&$a) {
+function navbar_complete(App &$a) {
 
 //     logger('navbar_complete');
 
index 678c0ca3331ae8ab4036e580d11684b8d36ac838..3543a38362d995a38dabcab6c86f72e15b60b26d 100644 (file)
         * @hook 'logged_in'
         *              array $user     logged user record
         */
-       function api_login(&$a){
+       function api_login(App &$a){
                // login with oauth
                try{
                        $oauth = new FKOAuth1();
         * @param App $a
         * @return string API call result
         */
-       function api_call(&$a){
-               GLOBAL $API, $called_api;
+       function api_call(App &$a){
+               global $API, $called_api;
 
                $type="json";
                if (strpos($a->query_string, ".xml")>0) $type="xml";
                        intval($gid),
                        dbesc($name));
                // error message if specified gid is not in database
-               if (count($rname) == 0)
+               if (!dbm::is_result($rname))
                        throw new BadRequestException('wrong group name');
 
                // delete group
                        intval($uid),
                        dbesc($name));
                // error message if specified group name already exists
-               if (count($rname) != 0)
+               if (dbm::is_result($rname))
                        throw new BadRequestException('group name already exists');
 
                // check if specified group name is a deleted group
                        intval($uid),
                        dbesc($name));
                // error message if specified group name already exists
-               if (count($rname) != 0)
+               if (dbm::is_result($rname))
                        $reactivate_group = true;
 
                // create group
index 36675da87329b37f5fa223afa51e1427454af6c4..fee569e94da5cbde46b0b346d073df1356461f06 100644 (file)
@@ -135,8 +135,8 @@ function fileas_widget($baseurl,$selected = '') {
 
        $matches = false;
        $terms = array();
-    $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
-    if($cnt) {
+       $cnt = preg_match_all('/\[(.*?)\]/',$saved,$matches,PREG_SET_ORDER);
+       if ($cnt) {
                foreach($matches as $mtch) {
                        $unescaped = xmlify(file_tag_decode($mtch[1]));
                        $terms[] = array('name' => $unescaped,'selected' => (($selected == $unescaped) ? 'selected' : ''));
@@ -158,12 +158,14 @@ function categories_widget($baseurl,$selected = '') {
 
        $a = get_app();
 
-       if(! feature_enabled($a->profile['profile_uid'],'categories'))
+       if (! feature_enabled($a->profile['profile_uid'],'categories')) {
                return '';
+       }
 
        $saved = get_pconfig($a->profile['profile_uid'],'system','filetags');
-       if(! strlen($saved))
+       if (! strlen($saved)) {
                return;
+       }
 
        $matches = false;
        $terms = array();
index 77332dcec6c2daa300b2222b496dfd2fee0cdbc8..e98239b82931aa4a74f56904037843c1385f1102 100644 (file)
@@ -264,7 +264,7 @@ function cron_poll_contacts($argc, $argv) {
                        intval($c['id'])
                );
 
-               if((! $res) || (! count($res)))
+               if (dbm::is_result($res))
                        continue;
 
                foreach($res as $contact) {
@@ -343,7 +343,7 @@ function cron_poll_contacts($argc, $argv) {
  *
  * @param App $a
  */
-function cron_clear_cache(&$a) {
+function cron_clear_cache(App &$a) {
 
        $last = get_config('system','cache_last_cleared');
 
@@ -430,7 +430,7 @@ function cron_clear_cache(&$a) {
  *
  * @param App $a
  */
-function cron_repair_diaspora(&$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 fef9ae2fedf07611858821eb6afb8ff2e2afd444..5e4f03779682e71367638fe9325170e5a25ad418 100644 (file)
@@ -2355,7 +2355,7 @@ class dfrn {
                                                dbesc($xt->id),
                                                intval($importer["importer_uid"])
                                        );
-                                       if(count($i)) {
+                                       if (dbm::is_result($i)) {
 
                                                // For tags, the owner cannot remove the tag on the author's copy of the post.
 
index fbfc497b59e383940382bdf0e9ea3aaa44d0c652..db2cca471bcad6cf6a81f4b7f72befa6f3fbab60 100644 (file)
@@ -2283,8 +2283,9 @@ class Diaspora {
                        dbesc($target_guid),
                        intval($importer["uid"])
                );
-               if (!$r)
+               if (!$r) {
                        return false;
+               }
 
                // Check if the sender is the thread owner
                $p = q("SELECT `id`, `author-link`, `origin` FROM `item` WHERE `id` = %d",
@@ -2307,7 +2308,7 @@ class Diaspora {
                logger("Deleted target ".$target_guid." (".$r[0]["id"].") from user ".$importer["uid"]." parent: ".$p[0]["id"], LOGGER_DEBUG);
 
                // Now check if the retraction needs to be relayed by us
-               if($p[0]["origin"]) {
+               if ($p[0]["origin"]) {
                        // notify others
                        proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $r[0]["id"]);
                }
@@ -2478,15 +2479,17 @@ class Diaspora {
         * @return string the handle in the format user@domain.tld
         */
        private static function my_handle($contact) {
-               if ($contact["addr"] != "")
+               if ($contact["addr"] != "") {
                        return $contact["addr"];
+               }
 
                // Normally we should have a filled "addr" field - but in the past this wasn't the case
                // So - just in case - we build the the address here.
-               if ($contact["nickname"] != "")
+               if ($contact["nickname"] != "") {
                        $nick = $contact["nickname"];
-               else
+               } else {
                        $nick = $contact["nick"];
+               }
 
                return $nick."@".substr(App::get_baseurl(), strpos(App::get_baseurl(),"://") + 3);
        }
index 791c331bbbe7295544f871101053203cd96f7904..a1ff9bb3364dbb735cadcf275855d21fa7dd59dd 100644 (file)
@@ -206,7 +206,7 @@ function bbtoevent($s) {
 }
 
 
-function sort_by_date($a) {
+function sort_by_date(App &$a) {
 
        usort($a,'ev_compare');
        return $a;
index e7693822abc17575d2f57a7aab67b944ecf4491d..30451910772295fb824e8ac66b127b51100182e5 100644 (file)
@@ -102,8 +102,7 @@ function new_contact($uid,$url,$interactive = false) {
                if ($interactive) {
                        if (strlen($a->path)) {
                                $myaddr = bin2hex(App::get_baseurl() . '/profile/' . $a->user['nickname']);
-                       }
-                       else {
+                       } else {
                                $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());
                        }
 
@@ -111,53 +110,43 @@ function new_contact($uid,$url,$interactive = false) {
 
                        // NOTREACHED
                }
+       } elseif (get_config('system','dfrn_only')) {
+               $result['message'] = t('This site is not configured to allow communications with other networks.') . EOL;
+               $result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL;
+               return $result;
        }
-       else {
-               if(get_config('system','dfrn_only')) {
-                       $result['message'] = t('This site is not configured to allow communications with other networks.') . EOL;
-                       $result['message'] != t('No compatible communication protocols or feeds were discovered.') . EOL;
-                       return $result;
-               }
-       }
-
-
-
-
-
 
        // This extra param just confuses things, remove it
-       if($ret['network'] === NETWORK_DIASPORA)
+       if ($ret['network'] === NETWORK_DIASPORA) {
                $ret['url'] = str_replace('?absolute=true','',$ret['url']);
-
+       }
 
        // do we have enough information?
 
-       if(! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
+       if (! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) {
                $result['message'] .=  t('The profile address specified does not provide adequate information.') . EOL;
-               if(! x($ret,'poll'))
+               if (! x($ret,'poll')) {
                        $result['message'] .= t('No compatible communication protocols or feeds were discovered.') . EOL;
-               if(! x($ret,'name'))
+               }
+               if (! x($ret,'name')) {
                        $result['message'] .=  t('An author or name was not found.') . EOL;
-               if(! x($ret,'url'))
+               }
+               if (! x($ret,'url')) {
                        $result['message'] .=  t('No browser URL could be matched to this address.') . EOL;
-               if(strpos($url,'@') !== false) {
+               }
+               if (strpos($url,'@') !== false) {
                        $result['message'] .=  t('Unable to match @-style Identity Address with a known protocol or email contact.') . EOL;
                        $result['message'] .=  t('Use mailto: in front of address to force email check.') . EOL;
                }
                return $result;
        }
 
-       if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
+       if ($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) {
                $result['message'] .= t('The profile address specified belongs to a network which has been disabled on this site.') . EOL;
                $ret['notify'] = '';
        }
 
-
-
-
-
-
-       if(! $ret['notify']) {
+       if (! $ret['notify']) {
                $result['message'] .=  t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL;
        }
 
@@ -167,8 +156,9 @@ function new_contact($uid,$url,$interactive = false) {
 
        $hidden = (($ret['network'] === NETWORK_MAIL) ? 1 : 0);
 
-       if(in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA)))
+       if (in_array($ret['network'], array(NETWORK_MAIL, NETWORK_DIASPORA))) {
                $writeable = 1;
+       }
 
        // check if we already have a contact
        // the poll url is more reliable than the profile url, as we may have
@@ -188,7 +178,7 @@ function new_contact($uid,$url,$interactive = false) {
 
        if (dbm::is_result($r)) {
                // update contact
-               if($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
+               if ($r[0]['rel'] == CONTACT_IS_FOLLOWER || ($network === NETWORK_DIASPORA && $r[0]['rel'] == CONTACT_IS_SHARING)) {
                        q("UPDATE `contact` SET `rel` = %d , `subhub` = %d, `readonly` = 0 WHERE `id` = %d AND `uid` = %d",
                                intval(CONTACT_IS_FRIEND),
                                intval($subhub),
@@ -197,29 +187,28 @@ function new_contact($uid,$url,$interactive = false) {
                        );
                }
        } else {
-
-
                // check service class limits
 
-               $r = q("select count(*) as total from contact where uid = %d and pending = 0 and self = 0",
+               $r = q("SELECT COUNT(*) AS `total` FROM `contact` WHERE `uid` = %d AND `pending` = 0 AND `self` = 0",
                        intval($uid)
                );
                if (dbm::is_result($r))
                        $total_contacts = $r[0]['total'];
 
-               if(! service_class_allows($uid,'total_contacts',$total_contacts)) {
+               if (! service_class_allows($uid,'total_contacts',$total_contacts)) {
                        $result['message'] .= upgrade_message();
                        return $result;
                }
 
-               $r = q("select count(network) as total from contact where uid = %d and network = '%s' and pending = 0 and self = 0",
+               $r = q("SELECT COUNT(`network`) AS `total` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND `pending` = 0 AND `self` = 0",
                        intval($uid),
                        dbesc($network)
                );
-               if (dbm::is_result($r))
+               if (dbm::is_result($r)) {
                        $total_network = $r[0]['total'];
+               }
 
-               if(! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
+               if (! service_class_allows($uid,'total_contacts_' . $network,$total_network)) {
                        $result['message'] .= upgrade_message();
                        return $result;
                }
@@ -268,8 +257,9 @@ function new_contact($uid,$url,$interactive = false) {
        $result['cid'] = $contact_id;
 
        $def_gid = get_default_group($uid, $contact["network"]);
-       if (intval($def_gid))
+       if (intval($def_gid)) {
                group_add_member($uid, '', $contact_id, $def_gid);
+       }
 
        // Update the avatar
        update_contact_avatar($ret['photo'],$uid,$contact_id);
@@ -285,7 +275,6 @@ function new_contact($uid,$url,$interactive = false) {
 
        if (dbm::is_result($r)) {
                if (($contact['network'] == NETWORK_OSTATUS) && (strlen($contact['notify']))) {
-
                        // create a follow slap
                        $item = array();
                        $item['verb'] = ACTIVITY_FOLLOW;
index 70ff7f00ac7f801d90d2c42c2d9cf55a81a3cc25..a302dc34cd661822400c64ff9976cc125f3c08b0 100644 (file)
@@ -231,8 +231,7 @@ function profile_sidebar($profile, $block = 0) {
        if ($connect AND local_user()) {
                if (isset($profile["url"])) {
                        $profile_url = normalise_link($profile["url"]);
-               }
-               else {
+               } else {
                        $profile_url = normalise_link(App::get_baseurl()."/profile/".$profile["nickname"]);
                }
 
@@ -599,7 +598,7 @@ function get_events() {
        ));
 }
 
-function advanced_profile(&$a) {
+function advanced_profile(App &$a) {
 
        $o = '';
        $uid = $a->profile['uid'];
@@ -638,50 +637,87 @@ function advanced_profile(&$a) {
 
                if($a->profile['marital']) $profile['marital'] = array( t('Status:'), $a->profile['marital']);
 
+               /// @TODO Maybe use x() here, plus below?
+               if ($a->profile['with']) {
+                       $profile['marital']['with'] = $a->profile['with'];
+               }
 
-               if($a->profile['with']) $profile['marital']['with'] = $a->profile['with'];
-
-               if(strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
-                               $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
+               if (strlen($a->profile['howlong']) && $a->profile['howlong'] !== '0000-00-00 00:00:00') {
+                       $profile['howlong'] = relative_date($a->profile['howlong'], t('for %1$d %2$s'));
                }
 
-               if($a->profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
+               if ($a->profile['sexual']) {
+                       $profile['sexual'] = array( t('Sexual Preference:'), $a->profile['sexual'] );
+               }
 
-               if($a->profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
+               if ($a->profile['homepage']) {
+                       $profile['homepage'] = array( t('Homepage:'), linkify($a->profile['homepage']) );
+               }
 
-               if($a->profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
+               if ($a->profile['hometown']) {
+                       $profile['hometown'] = array( t('Hometown:'), linkify($a->profile['hometown']) );
+               }
 
-               if($a->profile['pub_keywords']) $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
+               if ($a->profile['pub_keywords']) {
+                       $profile['pub_keywords'] = array( t('Tags:'), $a->profile['pub_keywords']);
+               }
 
-               if($a->profile['politic']) $profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
+               if ($a->profile['politic']) {
+                       $profile['politic'] = array( t('Political Views:'), $a->profile['politic']);
+               }
 
-               if($a->profile['religion']) $profile['religion'] = array( t('Religion:'), $a->profile['religion']);
+               if ($a->profile['religion']) {
+                       $profile['religion'] = array( t('Religion:'), $a->profile['religion']);
+               }
 
-               if($txt = prepare_text($a->profile['about'])) $profile['about'] = array( t('About:'), $txt );
+               if ($txt = prepare_text($a->profile['about'])) {
+                       $profile['about'] = array( t('About:'), $txt );
+               }
 
-               if($txt = prepare_text($a->profile['interest'])) $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
+               if ($txt = prepare_text($a->profile['interest'])) {
+                       $profile['interest'] = array( t('Hobbies/Interests:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['likes'])) $profile['likes'] = array( t('Likes:'), $txt);
+               if ($txt = prepare_text($a->profile['likes'])) {
+                       $profile['likes'] = array( t('Likes:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['dislikes'])) $profile['dislikes'] = array( t('Dislikes:'), $txt);
+               if ($txt = prepare_text($a->profile['dislikes'])) {
+                       $profile['dislikes'] = array( t('Dislikes:'), $txt);
+               }
 
+               if ($txt = prepare_text($a->profile['contact'])) {
+                       $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['contact'])) $profile['contact'] = array( t('Contact information and Social Networks:'), $txt);
+               if ($txt = prepare_text($a->profile['music'])) {
+                       $profile['music'] = array( t('Musical interests:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['music'])) $profile['music'] = array( t('Musical interests:'), $txt);
+               if ($txt = prepare_text($a->profile['book'])) {
+                       $profile['book'] = array( t('Books, literature:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['book'])) $profile['book'] = array( t('Books, literature:'), $txt);
+               if ($txt = prepare_text($a->profile['tv'])) {
+                       $profile['tv'] = array( t('Television:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['tv'])) $profile['tv'] = array( t('Television:'), $txt);
+               if ($txt = prepare_text($a->profile['film'])) {
+                       $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['film'])) $profile['film'] = array( t('Film/dance/culture/entertainment:'), $txt);
+               if ($txt = prepare_text($a->profile['romance'])) {
+                       $profile['romance'] = array( t('Love/Romance:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['romance'])) $profile['romance'] = array( t('Love/Romance:'), $txt);
+               if ($txt = prepare_text($a->profile['work'])) {
+                       $profile['work'] = array( t('Work/employment:'), $txt);
+               }
 
-               if($txt = prepare_text($a->profile['work'])) $profile['work'] = array( t('Work/employment:'), $txt);
+               if ($txt = prepare_text($a->profile['education'])) {
+                       $profile['education'] = array( t('School/education:'), $txt );
+               }
 
-               if($txt = prepare_text($a->profile['education'])) $profile['education'] = array( t('School/education:'), $txt );
-       
                //show subcribed forum if it is enabled in the usersettings
                if (feature_enabled($uid,'forumlist_profile')) {
                        $profile['forumlist'] = array( t('Forums:'), ForumManager::profile_advanced($uid));
@@ -705,11 +741,13 @@ function advanced_profile(&$a) {
 function profile_tabs($a, $is_owner=False, $nickname=Null){
        //echo "<pre>"; var_dump($a->user); killme();
 
-       if (is_null($nickname))
+       if (is_null($nickname)) {
                $nickname  = $a->user['nickname'];
+       }
 
-       if(x($_GET,'tab'))
+       if (x($_GET,'tab')) {
                $tab = notags(trim($_GET['tab']));
+       }
 
        $url = App::get_baseurl() . '/profile/' . $nickname;
 
@@ -807,7 +845,7 @@ function get_my_url() {
        return false;
 }
 
-function zrl_init(&$a) {
+function zrl_init(App &$a) {
        $tmp_str = get_my_url();
        if(validate_url($tmp_str)) {
 
index 10afc28c0e07c4633e6c6183ff844627e9d557a7..fa4f3290b142090168fbd36222e13d9f4b75840f 100644 (file)
@@ -704,7 +704,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                        // If its a post from myself then tag the thread as "mention"
                        logger("item_store: Checking if parent ".$parent_id." has to be tagged as mention for user ".$arr['uid'], LOGGER_DEBUG);
                        $u = q("SELECT `nickname` FROM `user` WHERE `uid` = %d", intval($arr['uid']));
-                       if (count($u)) {
+                       if (dbm::is_result($u)) {
                                $a = get_app();
                                $self = normalise_link(App::get_baseurl() . '/profile/' . $u[0]['nickname']);
                                logger("item_store: 'myself' is ".$self." for parent ".$parent_id." checking against ".$arr['author-link']." and ".$arr['owner-link'], LOGGER_DEBUG);
@@ -953,14 +953,16 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        // in it.
        if (!$deleted AND !$dontcache) {
 
-               $r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
-               if (count($r) == 1) {
-                       if ($notify)
+               $r = q('SELECT * FROM `item` WHERE `id` = %d', intval($current_post));
+               if ((dbm::is_result($r)) && (count($r) == 1)) {
+                       if ($notify) {
                                call_hooks('post_local_end', $r[0]);
-                       else
+                       } else {
                                call_hooks('post_remote_end', $r[0]);
-               } else
+                       }
+               } else {
                        logger('item_store: new item not found in DB, id ' . $current_post);
+               }
        }
 
        if ($arr['parent-uri'] === $arr['uri']) {
@@ -994,8 +996,9 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
 
        check_item_notification($current_post, $uid);
 
-       if ($notify)
+       if ($notify) {
                proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $current_post);
+       }
 
        return $current_post;
 }
@@ -1188,19 +1191,22 @@ function tag_deliver($uid,$item_id) {
        $u = q("select * from user where uid = %d limit 1",
                intval($uid)
        );
-       if (! count($u))
+
+       if (! dbm::is_result($u)) {
                return;
+       }
 
        $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
        $prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
 
 
-       $i = q("select * from item where id = %d and uid = %d limit 1",
+       $i = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($item_id),
                intval($uid)
        );
-       if (! count($i))
+       if (! dbm::is_result($i)) {
                return;
+       }
 
        $item = $i[0];
 
@@ -1257,7 +1263,7 @@ function tag_deliver($uid,$item_id) {
        $c = q("select name, url, thumb from contact where self = 1 and uid = %d limit 1",
                intval($u[0]['uid'])
        );
-       if (! count($c)) {
+       if (! dbm::is_result($c)) {
                return;
        }
 
@@ -1290,8 +1296,6 @@ function tag_deliver($uid,$item_id) {
 
 function tgroup_check($uid,$item) {
 
-       $a = get_app();
-
        $mention = false;
 
        // check that the message originated elsewhere and is a top-level post
@@ -1299,12 +1303,13 @@ function tgroup_check($uid,$item) {
        if (($item['wall']) || ($item['origin']) || ($item['uri'] != $item['parent-uri']))
                return false;
 
-
-       $u = q("select * from user where uid = %d limit 1",
+       /// @TODO Encapsulate this or find it encapsulated and replace all occurrances
+       $u = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
                intval($uid)
        );
-       if (! count($u))
+       if (! dbm::is_result($u)) {
                return false;
+       }
 
        $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
        $prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
@@ -2228,7 +2233,7 @@ function posted_date_widget($url,$uid,$wall) {
 
        $ret = list_post_dates($uid,$wall);
 
-       if (! count($ret))
+       if (! dbm::is_result($ret))
                return $o;
 
        $cutoff_year = intval(datetime_convert('',date_default_timezone_get(),'now','Y')) - $visible_years;
index 893047da3c252f9d6216c4271f87735d9b162f26..210bde690656e84e777c0b6771dc6ee57f867939 100644 (file)
@@ -112,8 +112,9 @@ function do_like($item_id, $verb) {
                        intval($_SESSION['visitor_id']),
                        intval($owner_uid)
                );
-               if (dbm::is_result($r))
+               if (dbm::is_result($r)) {
                        $contact = $r[0];
+               }
        }
        if (! $contact) {
                return false;
index f71272f3b1bae1d55a51cf2b8248d56e6da0a335..bd933929d3b6b78ee7e8a3113558cd965e3d152d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function nav(&$a) {
+function nav(App &$a) {
 
        /*
         *
index 7a662e4cbf08585a3a1bed493c060ab0418a600a..969f583828851a59ceb55c97d072a6bae5ef325a 100644 (file)
@@ -541,10 +541,11 @@ function parse_xml_string($s,$strict = true) {
        libxml_use_internal_errors(true);
 
        $x = @simplexml_load_string($s2);
-       if(! $x) {
+       if (! $x) {
                logger('libxml: parse: error: ' . $s2, LOGGER_DATA);
-               foreach(libxml_get_errors() as $err)
+               foreach (libxml_get_errors() as $err) {
                        logger('libxml: parse: ' . $err->code." at ".$err->line.":".$err->column." : ".$err->message, LOGGER_DATA);
+               }
                libxml_clear_errors();
        }
        return $x;
@@ -553,8 +554,9 @@ function parse_xml_string($s,$strict = true) {
 function scale_external_images($srctext, $include_link = true, $scale_replace = false) {
 
        // Suppress "view full size"
-       if (intval(get_config('system','no_view_full_size')))
+       if (intval(get_config('system','no_view_full_size'))) {
                $include_link = false;
+       }
 
        $a = get_app();
 
@@ -563,38 +565,41 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
 
        $matches = null;
        $c = preg_match_all('/\[img.*?\](.*?)\[\/img\]/ism',$s,$matches,PREG_SET_ORDER);
-       if($c) {
+       if ($c) {
                require_once('include/Photo.php');
-               foreach($matches as $mtch) {
+               foreach ($matches as $mtch) {
                        logger('scale_external_image: ' . $mtch[1]);
 
                        $hostname = str_replace('www.','',substr(App::get_baseurl(),strpos(App::get_baseurl(),'://')+3));
-                       if(stristr($mtch[1],$hostname))
+                       if (stristr($mtch[1],$hostname)) {
                                continue;
+                       }
 
                        // $scale_replace, if passed, is an array of two elements. The
                        // first is the name of the full-size image. The second is the
                        // name of a remote, scaled-down version of the full size image.
                        // This allows Friendica to display the smaller remote image if
                        // one exists, while still linking to the full-size image
-                       if($scale_replace)
+                       if ($scale_replace) {
                                $scaled = str_replace($scale_replace[0], $scale_replace[1], $mtch[1]);
-                       else
+                       } else {
                                $scaled = $mtch[1];
-                       $i = @fetch_url($scaled);
-                       if(! $i)
+                       }
+                       $i = fetch_url($scaled);
+                       if (! $i) {
                                return $srctext;
+                       }
 
                        // guess mimetype from headers or filename
                        $type = guess_image_type($mtch[1],true);
 
-                       if($i) {
+                       if ($i) {
                                $ph = new Photo($i, $type);
-                               if($ph->is_valid()) {
+                               if ($ph->is_valid()) {
                                        $orig_width = $ph->getWidth();
                                        $orig_height = $ph->getHeight();
 
-                                       if($orig_width > 640 || $orig_height > 640) {
+                                       if ($orig_width > 640 || $orig_height > 640) {
 
                                                $ph->scaleImage(640);
                                                $new_width = $ph->getWidth();
@@ -620,7 +625,7 @@ function scale_external_images($srctext, $include_link = true, $scale_replace =
 function fix_contact_ssl_policy(&$contact,$new_policy) {
 
        $ssl_changed = false;
-       if((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
+       if ((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
                $ssl_changed = true;
                $contact['url']     =   str_replace('https:','http:',$contact['url']);
                $contact['request'] =   str_replace('https:','http:',$contact['request']);
@@ -630,7 +635,7 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
                $contact['poco']    =   str_replace('https:','http:',$contact['poco']);
        }
 
-       if((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
+       if ((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
                $ssl_changed = true;
                $contact['url']     =   str_replace('http:','https:',$contact['url']);
                $contact['request'] =   str_replace('http:','https:',$contact['request']);
@@ -640,15 +645,15 @@ function fix_contact_ssl_policy(&$contact,$new_policy) {
                $contact['poco']    =   str_replace('http:','https:',$contact['poco']);
        }
 
-       if($ssl_changed) {
-               q("update contact set
-                       url = '%s',
-                       request = '%s',
-                       notify = '%s',
-                       poll = '%s',
-                       confirm = '%s',
-                       poco = '%s'
-                       where id = %d limit 1",
+       if ($ssl_changed) {
+               q("UPDATE `contact` SET
+                       `url` = '%s',
+                       `request` = '%s',
+                       `notify` = '%s',
+                       `poll` = '%s',
+                       `confirm` = '%s',
+                       `poco` = '%s'
+                       WHERE `id` = %d LIMIT 1",
                        dbesc($contact['url']),
                        dbesc($contact['request']),
                        dbesc($contact['notify']),
index 39cb5d5231b6d3d5ddd67bccaed4d6b4efd3aa02..83f6f1ab9502a1f5b34e8c0039169b0d007d959a 100644 (file)
@@ -129,7 +129,7 @@ function reload_plugins() {
  */
 function plugin_enabled($plugin) {
        $r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
-       return((bool)(count($r) > 0));
+       return ((dbm::is_result($r)) && (count($r) > 0));
 }
 
 
@@ -413,7 +413,7 @@ function get_theme_info($theme){
 function get_theme_screenshot($theme) {
        $exts = array('.png','.jpg');
        foreach($exts as $ext) {
-               if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
+               if (file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
                        return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
                }
        }
@@ -425,8 +425,8 @@ if (! function_exists('uninstall_theme')){
 function uninstall_theme($theme){
        logger("Addons: uninstalling theme " . $theme);
 
-       @include_once("view/theme/$theme/theme.php");
-       if(function_exists("{$theme}_uninstall")) {
+       include_once("view/theme/$theme/theme.php");
+       if (function_exists("{$theme}_uninstall")) {
                $func = "{$theme}_uninstall";
                $func();
        }
@@ -436,19 +436,19 @@ if (! function_exists('install_theme')){
 function install_theme($theme) {
        // silently fail if theme was removed
 
-       if(! file_exists("view/theme/$theme/theme.php"))
+       if (! file_exists("view/theme/$theme/theme.php")) {
                return false;
+       }
 
        logger("Addons: installing theme $theme");
 
-       @include_once("view/theme/$theme/theme.php");
+       include_once("view/theme/$theme/theme.php");
 
-       if(function_exists("{$theme}_install")) {
+       if (function_exists("{$theme}_install")) {
                $func = "{$theme}_install";
                $func();
                return true;
-       }
-       else {
+       } else {
                logger("Addons: FAILED installing theme $theme");
                return false;
        }
@@ -467,10 +467,9 @@ function install_theme($theme) {
 
 function service_class_allows($uid,$property,$usage = false) {
 
-       if($uid == local_user()) {
+       if ($uid == local_user()) {
                $service_class = $a->user['service_class'];
-       }
-       else {
+       } else {
                $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
                        intval($uid)
                );
@@ -478,18 +477,23 @@ function service_class_allows($uid,$property,$usage = false) {
                        $service_class = $r[0]['service_class'];
                }
        }
-       if(! x($service_class))
-               return true; // everything is allowed
+
+       if (! x($service_class)) {
+               // everything is allowed
+               return true;
+       }
 
        $arr = get_config('service_class',$service_class);
-       if(! is_array($arr) || (! count($arr)))
+       if (! is_array($arr) || (! count($arr))) {
                return true;
+       }
 
-       if($usage === false)
+       if ($usage === false) {
                return ((x($arr[$property])) ? (bool) $arr['property'] : true);
-       else {
-               if(! array_key_exists($property,$arr))
+       else {
+               if (! array_key_exists($property,$arr)) {
                        return true;
+               }
                return (((intval($usage)) < intval($arr[$property])) ? true : false);
        }
 }
@@ -497,10 +501,9 @@ function service_class_allows($uid,$property,$usage = false) {
 
 function service_class_fetch($uid,$property) {
 
-       if($uid == local_user()) {
+       if ($uid == local_user()) {
                $service_class = $a->user['service_class'];
-       }
-       else {
+       } else {
                $r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
                        intval($uid)
                );
index a6671f5ae39c26618e35c8d9f333396c45aee432..b631d2acd15637dad371c7cb122be456d45e22bf 100644 (file)
@@ -213,7 +213,7 @@ function poller_max_connections_reached() {
        // The processlist only shows entries of the current user
        if ($max != 0) {
                $r = q("SHOW PROCESSLIST");
-               if (!$r)
+               if (!dbm::is_result($r))
                        return false;
 
                $used = count($r);
index 2e0b19bfae4019cc9d47afd45bba7e328b8ec7c6..f36e7723cd209b14978bcb40cadddfaaafafd3e2 100644 (file)
@@ -127,7 +127,7 @@ function queue_run(&$argv, &$argc){
                $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
                        intval($qi[0]['cid'])
                );
-               if(! count($c)) {
+               if (! dbm::is_result($c)) {
                        remove_queue_item($q_item['id']);
                        continue;
                }
@@ -157,7 +157,7 @@ function queue_run(&$argv, &$argc){
                        FROM `user` WHERE `uid` = %d LIMIT 1",
                        intval($c[0]['uid'])
                );
-               if(! count($u)) {
+               if (! dbm::is_result($u)) {
                        remove_queue_item($q_item['id']);
                        continue;
                }
index 64f78b4585cc544fbc6c517b8c0e28cc13a3050a..6249f189e9a0a0d30c0b44cfa4fa78fd95ba86ec 100644 (file)
@@ -220,8 +220,9 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
        $r = q("SELECT `network` FROM `contact` WHERE `nurl` = '%s' AND `network` != '' AND `network` != '%s' LIMIT 1",
                dbesc(normalise_link($profile_url)), dbesc(NETWORK_STATUSNET)
        );
-       if (dbm::is_result($r))
+       if (dbm::is_result($r)) {
                $network = $r[0]["network"];
+       }
 
        if (($network == "") OR ($network == NETWORK_OSTATUS)) {
                $r = q("SELECT `network`, `url` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `network` != '' AND `network` != '%s' LIMIT 1",
@@ -1575,7 +1576,7 @@ function get_gcontact_id($contact) {
                proc_run(PRIORITY_LOW, 'include/gprobe.php', bin2hex($contact["url"]));
        }
 
-       if ((count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
+       if ((dbm::is_result($r)) AND (count($r) > 1) AND ($gcontact_id > 0) AND ($contact["url"] != ""))
         q("DELETE FROM `gcontact` WHERE `nurl` = '%s' AND `id` != %d",
                dbesc(normalise_link($contact["url"])),
                intval($gcontact_id));
index 4f71ab8e60ad60efeec35507b05bca59b239c8fe..6672b0d32f790a9ad08a7a89b332590cc8682066 100644 (file)
@@ -369,7 +369,7 @@ if(! function_exists('paginate')) {
  * @param App $a App instance
  * @return string html for pagination #FIXME remove html
  */
-function paginate(&$a) {
+function paginate(App &$a) {
 
        $data = paginate_data($a);
        $tpl = get_markup_template("paginate.tpl");
index 983c4a416b32429017ab47817dd8412ac4bdd20b..df871c5468ac7d3abb7087adb87635b453633d25 100644 (file)
@@ -241,7 +241,7 @@ function create_user($arr) {
                WHERE `nickname` = '%s' ",
                dbesc($nickname)
        );
-       if((count($r) > 1) && $newuid) {
+       if ((dbm::is_result($r)) && (count($r) > 1) && $newuid) {
                $result['message'] .= t('Nickname is already registered. Please choose another.') . EOL;
                q("DELETE FROM `user` WHERE `uid` = %d",
                        intval($newuid)
@@ -262,7 +262,7 @@ function create_user($arr) {
                        intval($netpublish)
 
                );
-               if($r === false) {
+               if ($r === false) {
                        $result['message'] .=  t('An error occurred creating your default profile. Please try again.') . EOL;
                        // Start fresh next time.
                        $r = q("DELETE FROM `user` WHERE `uid` = %d",
@@ -325,24 +325,27 @@ function create_user($arr) {
 
                        $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 4 );
 
-                       if($r === false)
+                       if ($r === false) {
                                $photo_failure = true;
+                       }
 
                        $img->scaleImage(80);
 
                        $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 5 );
 
-                       if($r === false)
+                       if ($r === false) {
                                $photo_failure = true;
+                       }
 
                        $img->scaleImage(48);
 
                        $r = $img->store($newuid, 0, $hash, $filename, t('Profile Photos'), 6 );
 
-                       if($r === false)
+                       if ($r === false) {
                                $photo_failure = true;
+                       }
 
-                       if(! $photo_failure) {
+                       if (! $photo_failure) {
                                q("UPDATE `photo` SET `profile` = 1 WHERE `resource-id` = '%s' ",
                                        dbesc($hash)
                                );
index 62909d47159dad02a25b1c6b3f7c03531a155111..e01e652ae44478a3ad202dea05c1b6768f1ef579 100644 (file)
@@ -123,15 +123,17 @@ class b8_storage_frndc extends b8_storage_base
        function __destruct()
        {
 
-               if($this->_connection === NULL)
+               if ($this->_connection === NULL) {
                        return;
+               }
 
-               # Commit any changes before closing
+               // Commit any changes before closing
                $this->_commit();
 
-               # Just close the connection if no link-resource was passed and b8 created it's own connection
-               if($this->config['connection'] === NULL)
+               // Just close the connection if no link-resource was passed and b8 created it's own connection
+               if ($this->config['connection'] === NULL) {
                        mysql_close($this->_connection);
+               }
 
                $this->connected = FALSE;
 
@@ -163,9 +165,8 @@ class b8_storage_frndc extends b8_storage_base
        protected function _get_query($tokens, $uid)
        {
 
-               # Construct the query ...
-
-               if(count($tokens) > 0) {
+               // Construct the query ...
+               if (count($tokens) > 0) {
 
                        $where = array();
 
@@ -175,42 +176,42 @@ class b8_storage_frndc extends b8_storage_base
                        }
 
                        $where = 'term IN ("' . implode('", "', $where) . '")';
-               }
-
-               else {
+               } else {
                        $token = dbesc($token);
                        $where = 'term = "' . $token . '"';
                }
 
-               # ... and fetch the data
+               // ... and fetch the data
 
-               $result = q('
-                       SELECT * FROM spam WHERE ' . $where . ' AND uid = ' . $uid );
+               $result = q('SELECT * FROM `spam` WHERE ' . $where . ' AND `uid` = ' . $uid );
 
 
                $returned_tokens = array();
-               if(count($result)) {
-                       foreach($result as $rr)
+               if (dbm::is_result($result)) {
+                       foreach ($result as $rr) {
                                $returned_tokens[] = $rr['term'];
+                       }
                }
                $to_create = array();
 
-               if(count($tokens) > 0) {
+               if (count($tokens) > 0) {
                        foreach($tokens as $token)
                                if(! in_array($token,$returned_tokens))
                                        $to_create[] = str_tolower($token); 
                }
-               if(count($to_create)) {
+               if (count($to_create)) {
                        $sql = '';
-                       foreach($to_create as $term) {
-                               if(strlen($sql))
+                       foreach ($to_create as $term) {
+                               if (strlen($sql)) {
                                        $sql .= ',';
-                               $sql .= sprintf("(term,datetime,uid) values('%s','%s',%d)",
-                                       dbesc(str_tolower($term))
+                               }
+                               $sql .= sprintf("(`term`,`datetime`,`uid`) VALUES('%s','%s',%d)",
+                                       dbesc(str_tolower($term)),
                                        dbesc(datetime_convert()),
                                        intval($uid)
                                );
-                       q("insert into spam " . $sql);
+                       }
+                       q("INSERT INTO `spam` " . $sql);
                }
 
                return $result;
@@ -225,7 +226,6 @@ class b8_storage_frndc extends b8_storage_base
         * @param string $count
         * @return void
         */
-
        protected function _put($token, $count, $uid) {
                $token = dbesc($token);
                $count = dbesc($count);
@@ -241,7 +241,6 @@ class b8_storage_frndc extends b8_storage_base
         * @param string $count
         * @return void
         */
-
        protected function _update($token, $count, $uid)
        {
                $token = dbesc($token);
@@ -257,7 +256,6 @@ class b8_storage_frndc extends b8_storage_base
         * @param string $token
         * @return void
         */
-
        protected function _del($token, $uid)
        {
                $token = dbesc($token);
@@ -272,7 +270,6 @@ class b8_storage_frndc extends b8_storage_base
         * @access protected
         * @return void
         */
-
        protected function _commit($uid)
        {
 
@@ -314,5 +311,3 @@ class b8_storage_frndc extends b8_storage_base
        }
 
 }
-
-?>
\ No newline at end of file
index 33070a1ecdf4dc071d65aabd94b67f530be47efe..eedddf1e5b46c97968e8bcf6835e4dc79dffbad2 100644 (file)
@@ -1,8 +1,9 @@
 <?php\r
+/// @TODO This file has DOS line endings!\r
 require_once("mod/hostxrd.php");\r
 require_once("mod/nodeinfo.php");\r
 \r
-function _well_known_init(&$a){\r
+function _well_known_init(App &$a){\r
        if ($a->argc > 1) {\r
                switch($a->argv[1]) {\r
                        case "host-meta":\r
@@ -20,7 +21,7 @@ function _well_known_init(&$a){
        killme();\r
 }\r
 \r
-function wk_social_relay(&$a) {\r
+function wk_social_relay(App &$a) {\r
 \r
        define('SR_SCOPE_ALL', 'all');\r
        define('SR_SCOPE_TAGS', 'tags');\r
index a2365803ac46047e1c1a2497520b21e46f9e0171..29f17d6e414d7765224922e3307363bd06be9887 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/Scrape.php');
 
-function acctlink_init(&$a) {
+function acctlink_init(App &$a) {
 
        if(x($_GET,'addr')) {
                $addr = trim($_GET['addr']);
index f5e04b96a75154ee76a042222925754164cfeaa4..802b0a399fd353d3b0c976f11ace6a1bc7264bc4 100644 (file)
@@ -3,7 +3,7 @@
 
 require_once("include/acl_selectors.php");
 
-function acl_init(&$a){
+function acl_init(App &$a){
        acl_lookup($a);
 }
 
index 841aaa7871463cc9e16bc3d108ece4f2384465e6..fd57f92d5f54cc6ba204dfa203249ccb24a669b5 100644 (file)
@@ -23,7 +23,7 @@ require_once("include/text.php");
  * @param App $a
  *
  */
-function admin_post(&$a){
+function admin_post(App &$a){
 
 
        if(!is_site_admin()) {
@@ -127,7 +127,7 @@ function admin_post(&$a){
  * @param App $a
  * @return string
  */
-function admin_content(&$a) {
+function admin_content(App &$a) {
 
        if(!is_site_admin()) {
                return login(false);
@@ -260,7 +260,7 @@ function admin_content(&$a) {
  * @param App $a
  * @return string
  */
-function admin_page_federation(&$a) {
+function admin_page_federation(App &$a) {
        // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu
        // social and statusnet nodes this node is knowing
        //
@@ -393,7 +393,7 @@ function admin_page_federation(&$a) {
  * @param App $a
  * @return string
  */
-function admin_page_queue(&$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(&$a) {
  * @param App $a
  * @return string
  */
-function admin_page_summary(&$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",
@@ -504,7 +504,7 @@ function admin_page_summary(&$a) {
  * 
  * @param App $a
  */
-function admin_page_site_post(&$a) {
+function admin_page_site_post(App &$a) {
        if(!x($_POST,"page_site")) {
                return;
        }
@@ -845,7 +845,7 @@ function admin_page_site_post(&$a) {
  * @param  App $a
  * @return string
  */
-function admin_page_site(&$a) {
+function admin_page_site(App &$a) {
 
        /* Installed langs */
        $lang_choices = get_available_languages();
@@ -1072,7 +1072,7 @@ function admin_page_site(&$a) {
  * @param App $a
  * @return string
  **/
-function admin_page_dbsync(&$a) {
+function admin_page_dbsync(App &$a) {
 
        $o = '';
 
@@ -1155,22 +1155,22 @@ function admin_page_dbsync(&$a) {
  * 
  * @param App $a
  */
-function admin_page_users_post(&$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']     : '');
-       $nu_nickname =  (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
-       $nu_email    =  (x($_POST, 'new_user_email')    ? $_POST['new_user_email']    : '');
+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']     : '');
+       $nu_nickname = (x($_POST, 'new_user_nickname') ? $_POST['new_user_nickname'] : '');
+       $nu_email    = (x($_POST, 'new_user_email')    ? $_POST['new_user_email']    : '');
        $nu_language = get_config('system', 'language');
 
        check_form_security_token_redirectOnErr('/admin/users', 'admin_users');
 
-       if(!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
+       if (!($nu_name==="") && !($nu_email==="") && !($nu_nickname==="")) {
                require_once('include/user.php');
 
                $result = create_user(array('username'=>$nu_name, 'email'=>$nu_email, 
                        'nickname'=>$nu_nickname, 'verified'=>1, 'language'=>$nu_language));
-               if(! $result['success']) {
+               if (! $result['success']) {
                        notice($result['message']);
                        return;
                }
@@ -1260,7 +1260,7 @@ function admin_page_users_post(&$a){
  * @param App $a
  * @return string
  */
-function admin_page_users(&$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));
@@ -1460,7 +1460,7 @@ function admin_page_users(&$a){
  * @param App $a
  * @return string
  */
-function admin_page_plugins(&$a){
+function admin_page_plugins(App &$a){
 
        /*
         * Single plugin
@@ -1669,7 +1669,7 @@ function rebuild_theme_table($themes) {
  * @param App $a
  * @return string
  */
-function admin_page_themes(&$a){
+function admin_page_themes(App &$a){
 
        $allowed_themes_str = get_config('system','allowed_themes');
        $allowed_themes_raw = explode(',',$allowed_themes_str);
@@ -1850,13 +1850,13 @@ function admin_page_themes(&$a){
  * 
  * @param App $a
  */
-function admin_page_logs_post(&$a) {
-       if(x($_POST,"page_logs")) {
+function admin_page_logs_post(App &$a) {
+       if (x($_POST,"page_logs")) {
                check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs');
 
-               $logfile        =       ((x($_POST,'logfile'))          ? notags(trim($_POST['logfile']))       : '');
-               $debugging      =       ((x($_POST,'debugging'))        ? true                                  : false);
-               $loglevel       =       ((x($_POST,'loglevel'))         ? intval(trim($_POST['loglevel']))      : 0);
+               $logfile   = ((x($_POST,'logfile'))   ? notags(trim($_POST['logfile']))  : '');
+               $debugging = ((x($_POST,'debugging')) ? true                             : false);
+               $loglevel  = ((x($_POST,'loglevel'))  ? intval(trim($_POST['loglevel'])) : 0);
 
                set_config('system','logfile', $logfile);
                set_config('system','debugging',  $debugging);
@@ -1884,7 +1884,7 @@ function admin_page_logs_post(&$a) {
  * @param App $a
  * @return string
  */
-function admin_page_logs(&$a){
+function admin_page_logs(App &$a){
 
        $log_choices = array(
                LOGGER_NORMAL   => 'Normal',
@@ -1941,7 +1941,7 @@ function admin_page_logs(&$a){
  * @param App $a
  * @return string
  */
-function admin_page_viewlogs(&$a){
+function admin_page_viewlogs(App &$a){
        $t = get_markup_template("admin_viewlogs.tpl");
        $f = get_config('system','logfile');
        $data = '';
@@ -1983,7 +1983,7 @@ function admin_page_viewlogs(&$a){
  * 
  * @param App $a
  */
-function admin_page_features_post(&$a) {
+function admin_page_features_post(App &$a) {
 
        check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features');
 
@@ -2029,7 +2029,7 @@ function admin_page_features_post(&$a) {
  * @param App $a
  * @return string
  */
-function admin_page_features(&$a) {
+function admin_page_features(App &$a) {
        
        if((argc() > 1) && (argv(1) === 'features')) {
                $arr = array();
index d7f4073b7ee5368b0f4a67b382bf61a687406851..7a134a7be190346c215d5d69b53ae208a576f098 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(&$a) {
+function allfriends_content(App &$a) {
 
        $o = '';
        if (! local_user()) {
@@ -21,14 +21,14 @@ function allfriends_content(&$a) {
                return;
        }
 
-       $uid = $a->user[uid];
+       $uid = $a->user['uid'];
 
        $c = q("SELECT `name`, `url`, `photo` FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                intval($cid),
                intval(local_user())
        );
 
-       if (! count($c)) {
+       if (! dbm::is_result($c)) {
                return;
        }
 
@@ -71,20 +71,20 @@ function allfriends_content(&$a) {
                }
 
                $entry = array(
-                       'url'           => $rr['url'],
-                       'itemurl'       => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
-                       'name'          => htmlentities($contact_details['name']),
-                       'thumb'         => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
-                       'img_hover'     => htmlentities($contact_details['name']),
-                       'details'       => $contact_details['location'],
-                       'tags'          => $contact_details['keywords'],
-                       'about'         => $contact_details['about'],
-                       'account_type'  => account_type($contact_details),
-                       'network'       => network_to_name($contact_details['network'], $contact_details['url']),
-                       'photo_menu'    => $photo_menu,
-                       'conntxt'       => t('Connect'),
-                       'connlnk'       => $connlnk,
-                       'id'            => ++$id,
+                       'url'          => $rr['url'],
+                       'itemurl'      => (($contact_details['addr'] != "") ? $contact_details['addr'] : $rr['url']),
+                       'name'         => htmlentities($contact_details['name']),
+                       'thumb'        => proxy_url($contact_details['thumb'], false, PROXY_SIZE_THUMB),
+                       'img_hover'    => htmlentities($contact_details['name']),
+                       'details'      => $contact_details['location'],
+                       'tags'         => $contact_details['keywords'],
+                       'about'        => $contact_details['about'],
+                       'account_type' => account_type($contact_details),
+                       'network'      => network_to_name($contact_details['network'], $contact_details['url']),
+                       'photo_menu'   => $photo_menu,
+                       'conntxt'      => t('Connect'),
+                       'connlnk'      => $connlnk,
+                       'id'           => ++$id,
                );
                $entries[] = $entry;
        }
index a2a1327e6df8b47c5452eb2fe0e1780294b26988..3fcdb42c8dd599306870815a7197ba99f0c0fec1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function amcd_content(&$a) {
+function amcd_content(App &$a) {
 //header("Content-type: text/json");
 echo <<< EOT
 {
index caa1cba2a6625e13d1f85029342bd87814337fd5..74a0cff6f4a17d3ecf1cb66e55eb1075320378f5 100644 (file)
@@ -20,7 +20,7 @@ function oauth_get_client($request){
        return $r[0];
 }
 
-function api_post(&$a) {
+function api_post(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -34,7 +34,7 @@ function api_post(&$a) {
 
 }
 
-function api_content(&$a) {
+function api_content(App &$a) {
        if ($a->cmd=='api/oauth/authorize'){
                /*
                 * api/oauth/authorize interact with the user. return a standard page
index a821ef5d5b89192b5534df7e8b78cd074e9a7964..4d6395e4ea64673f33ad3fd0517a15191d924393 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function apps_content(&$a) {
+function apps_content(App &$a) {
     $privateaddons = get_config('config','private_addons');
       if ($privateaddons === "1") {
        if((! (local_user())))  {
index 94cb75a386d2a7f6d7ae7681635a495d8f39d7ad..3b1fc0ec82514fe0111e0ad50342810d37696d31 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/security.php');
 
-function attach_init(&$a) {
+function attach_init(App &$a) {
 
        if($a->argc != 2) {
                notice( t('Item not available.') . EOL);
index d31e090c554ee7f0b2c4eb6e716ed5b0d1f646ab..5129f5bf594422486c23579e2b977555b39e48a8 100644 (file)
@@ -9,7 +9,7 @@ function visible_lf($s) {
        return str_replace("\n",'<br />', $s);
 }
 
-function babel_content(&$a) {
+function babel_content(App &$a) {
 
        $o .= '<h1>Babel Diagnostic</h1>';
 
index 86a73a788428d59158fff219cce5a44f743ccb56..9bc8c3353555a929c350a1bf739913ff32b390ff 100644 (file)
@@ -3,11 +3,11 @@
 require_once('include/conversation.php');
 require_once('include/items.php');
 
-function bookmarklet_init(&$a) {
+function bookmarklet_init(App &$a) {
        $_GET["mode"] = "minimal";
 }
 
-function bookmarklet_content(&$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 d49e8f76499a7fff1c15e963c34d924e10e6ef3a..7cb36e7a54fc9eaf6bd1a172fb9d17755ef4ed68 100644 (file)
@@ -9,7 +9,7 @@
 require_once('include/event.php');
 require_once('include/redir.php');
 
-function cal_init(&$a) {
+function cal_init(App &$a) {
        if($a->argc > 1)
                auto_redir($a, $a->argv[1]);
 
@@ -64,7 +64,7 @@ function cal_init(&$a) {
        return;
 }
 
-function cal_content(&$a) {
+function cal_content(App &$a) {
        nav_set_selected('events');
 
        $editselect = 'none';
index 6375d23984d708c989b81d53699843f9235fb076..90e41fb6d5e1d821dac470aff382c6076919dd83 100644 (file)
@@ -5,19 +5,19 @@
  */
 
 
-function cb_init(&$a) {
+function cb_init(App &$a) {
        call_hooks('cb_init');
 }
 
-function cb_post(&$a) {
+function cb_post(App &$a) {
        call_hooks('cb_post', $_POST);
 }
 
-function cb_afterpost(&$a) {
+function cb_afterpost(App &$a) {
        call_hooks('cb_afterpost');
 }
 
-function cb_content(&$a) {
+function cb_content(App &$a) {
        $o = '';
        call_hooks('cb_content', $o);
        return $o;
index 9657ac36d80afb8f83023163f07c33f077ab9377..26ef7e48b782af922433c3eb4f1a8fb4515649f2 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(&$a) {
+function common_content(App &$a) {
 
        $o = '';
 
@@ -53,8 +53,9 @@ function common_content(&$a) {
                $a->page['aside'] .= $vcard_widget;
        }
 
-       if(! count($c))
+       if (! dbm::is_result($c)) {
                return;
+       }
 
        if(! $cid) {
                if(get_my_url()) {
index d7fd2bb933ba0d70d3e0199a74ad7f83ae121793..2c2ea32b33cc5ee7e4413c14bc9dddc9beb08946 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function community_init(&$a) {
+function community_init(App &$a) {
        if (! local_user()) {
                unset($_SESSION['theme']);
                unset($_SESSION['mobile-theme']);
index 856b01dd504d406bdc6395f9a1170e203b5bf2af..553c7d6cd38b54f1cc4b5657c16b6da6b2b86e4a 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/group.php');
 
-function contactgroup_content(&$a) {
+function contactgroup_content(App &$a) {
 
 
        if (! local_user()) {
index b1553393e2aa29cab3ba6d1566093140ac97cab7..38e0992257d9f49f67508c6c9fd5b290e0c64416 100644 (file)
@@ -7,7 +7,7 @@ require_once('include/Scrape.php');
 require_once('mod/proxy.php');
 require_once('include/Photo.php');
 
-function contacts_init(&$a) {
+function contacts_init(App &$a) {
        if (! local_user()) {
                return;
        }
@@ -28,40 +28,45 @@ function contacts_init(&$a) {
        require_once('include/group.php');
        require_once('include/contact_widgets.php');
 
-       if ($_GET['nets'] == "all")
-       $_GET['nets'] = "";
+       if ($_GET['nets'] == "all") {
+               $_GET['nets'] = "";
+       }
 
-       if(! x($a->page,'aside'))
+       if (! x($a->page,'aside')) {
                $a->page['aside'] = '';
-
-       if($contact_id) {
-                       $a->data['contact'] = $r[0];
-
-                       if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) {
-                               $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']);
-                       } else
-                               $networkname = '';
-
-                       $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
-                               '$name' => htmlentities($a->data['contact']['name']),
-                               '$photo' => $a->data['contact']['photo'],
-                               '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/".$a->data['contact']['id'] : $a->data['contact']['url'],
-                               '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
-                               '$network_name' => $networkname,
-                               '$network' => t('Network:'),
-                               '$account_type' => account_type($a->data['contact'])
-                       ));
-                       $finpeople_widget = '';
-                       $follow_widget = '';
-                       $networks_widget = '';
        }
-       else {
+
+       if ($contact_id) {
+               $a->data['contact'] = $r[0];
+
+               if (($a->data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) {
+                       $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']);
+               } else {
+                       $networkname = '';
+               }
+
+               /// @TODO Add nice spaces
+               $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
+                       '$name' => htmlentities($a->data['contact']['name']),
+                       '$photo' => $a->data['contact']['photo'],
+                       '$url' => ($a->data['contact']['network'] == NETWORK_DFRN) ? "redir/".$a->data['contact']['id'] : $a->data['contact']['url'],
+                       '$addr' => (($a->data['contact']['addr'] != "") ? ($a->data['contact']['addr']) : ""),
+                       '$network_name' => $networkname,
+                       '$network' => t('Network:'),
+                       '$account_type' => account_type($a->data['contact'])
+               ));
+
+               $finpeople_widget = '';
+               $follow_widget = '';
+               $networks_widget = '';
+       } else {
                $vcard_widget = '';
                $networks_widget .= networks_widget('contacts',$_GET['nets']);
-               if (isset($_GET['add']))
+               if (isset($_GET['add'])) {
                        $follow_widget = follow_widget($_GET['add']);
-               else
+               } else {
                        $follow_widget = follow_widget();
+               }
 
                $findpeople_widget .= findpeople_widget();
        }
@@ -92,7 +97,7 @@ function contacts_init(&$a) {
 
 }
 
-function contacts_batch_actions(&$a){
+function contacts_batch_actions(App &$a){
        $contacts_id = $_POST['contact_batch'];
        if (!is_array($contacts_id)) return;
 
@@ -139,7 +144,7 @@ function contacts_batch_actions(&$a){
 }
 
 
-function contacts_post(&$a) {
+function contacts_post(App &$a) {
 
        if (! local_user()) {
                return;
@@ -344,7 +349,7 @@ function _contact_drop($contact_id, $orig_record) {
 }
 
 
-function contacts_content(&$a) {
+function contacts_content(App &$a) {
 
        $sort_type = 0;
        $o = '';
index f8cfb03f3782230e51ded8a973fb7e0455f2233c..84e32b83d578133c70c6be16b7f473fd3f8d523c 100644 (file)
@@ -5,7 +5,7 @@
  * addons repository will be listed though ATM)
  */
 
-function credits_content (&$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 59b92df0a7d0d8c48a6f0acbaa2d8cb6894e0072..c141958e8b958778acddab4e78858f7f2fd5697d 100644 (file)
@@ -2,7 +2,7 @@
 require_once("include/contact_selectors.php");
 require_once("mod/contacts.php");
 
-function crepair_init(&$a) {
+function crepair_init(App &$a) {
        if (! local_user()) {
                return;
        }
@@ -30,7 +30,7 @@ function crepair_init(&$a) {
        }
 }
 
-function crepair_post(&$a) {
+function crepair_post(App &$a) {
        if (! local_user()) {
                return;
        }
@@ -96,7 +96,7 @@ function crepair_post(&$a) {
 
 
 
-function crepair_content(&$a) {
+function crepair_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 1a3f13c763e4738903748dfd2b3a4c3513d53a0d..6930a5943a1c8e89c7fe104508c86e47061ea8af 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 require_once('mod/settings.php');
 
-function delegate_init(&$a) {
+function delegate_init(App &$a) {
        return settings_init($a);
 }
 
 
-function delegate_content(&$a) {
+function delegate_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -21,7 +21,6 @@ function delegate_content(&$a) {
                        goaway(App::get_baseurl() . '/delegate');
                }
 
-
                $id = $a->argv[2];
 
                $r = q("select `nickname` from user where uid = %d limit 1",
@@ -45,12 +44,11 @@ function delegate_content(&$a) {
        if ($a->argc > 2 && $a->argv[1] === 'remove' && intval($a->argv[2])) {
 
                // delegated admins can view but not change delegation permissions
-
                if (x($_SESSION,'submanage') && intval($_SESSION['submanage'])) {
                        goaway(App::get_baseurl() . '/delegate');
                }
 
-               q("delete from manage where uid = %d and mid = %d limit 1",
+               q("DELETE FROM `manage` WHERE `uid` = %d AND `mid` = %d LIMIT 1",
                        intval($a->argv[2]),
                        intval(local_user())
                );
index 684cd341e7e653314bb1a9753055ec3632b879e4..dc54b912d7c3e686b9250e464b8913dda37ba6d0 100644 (file)
@@ -415,23 +415,26 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
                        );
                }
 
-               if($r === false)
-                               notice( t('Unable to set contact photo.') . EOL);
+               /// @TODO is dbm::is_result() working here?
+               if ($r === false) {
+                       notice( t('Unable to set contact photo.') . EOL);
+               }
 
                // reload contact info
 
                $r = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
                        intval($contact_id)
                );
-               if (dbm::is_result($r))
+               if (dbm::is_result($r)) {
                        $contact = $r[0];
-               else
+               } else {
                        $contact = null;
+               }
 
 
-               if((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
+               if ((isset($new_relation) && $new_relation == CONTACT_IS_FRIEND)) {
 
-                       if(($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
+                       if (($contact) && ($contact['network'] === NETWORK_DIASPORA)) {
                                require_once('include/diaspora.php');
                                $ret = Diaspora::send_share($user[0],$r[0]);
                                logger('share returns: ' . $ret);
index ca12211583d4b116d6a503772ab012878a30edaf..eebaa076d94b9bc0ece344ee5e09ae9478f8ee37 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(&$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(&$a) {
 }
 
 
-function dfrn_notify_content(&$a) {
+function dfrn_notify_content(App &$a) {
 
        if(x($_GET,'dfrn_id')) {
 
index 0c55af2a8959f26f86ca7e6cdba4d9b054794115..a31a50ad254dbb21f011fa435b95c989a8368317 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/auth.php');
 require_once('include/dfrn.php');
 
 
-function dfrn_poll_init(&$a) {
+function dfrn_poll_init(App &$a) {
 
 
        $dfrn_id         = ((x($_GET,'dfrn_id'))         ? $_GET['dfrn_id']              : '');
@@ -137,7 +137,7 @@ function dfrn_poll_init(&$a) {
                        $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
                                intval($r[0]['cid'])
                        );
-                       if(! count($c)) {
+                       if (! dbm::is_result($c)) {
                                xml_status(3, 'No profile');
                        }
                        $contact = $c[0];
@@ -203,7 +203,7 @@ function dfrn_poll_init(&$a) {
 
 
 
-function dfrn_poll_post(&$a) {
+function dfrn_poll_post(App &$a) {
 
        $dfrn_id      = ((x($_POST,'dfrn_id'))      ? $_POST['dfrn_id']              : '');
        $challenge    = ((x($_POST,'challenge'))    ? $_POST['challenge']            : '');
@@ -234,7 +234,7 @@ function dfrn_poll_post(&$a) {
                        $c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
                                intval($r[0]['cid'])
                        );
-                       if(! count($c)) {
+                       if (! dbm::is_result($c)) {
                                xml_status(3, 'No profile');
                        }
                        $contact = $c[0];
@@ -383,7 +383,7 @@ function dfrn_poll_post(&$a) {
        }
 }
 
-function dfrn_poll_content(&$a) {
+function dfrn_poll_content(App &$a) {
 
        $dfrn_id         = ((x($_GET,'dfrn_id'))         ? $_GET['dfrn_id']              : '');
        $type            = ((x($_GET,'type'))            ? $_GET['type']                 : 'data');
index 68ef4971b4bd07b31998a9cfb481215a2d4e4638..353f8fdc96d5f49ff053437c2f3c6b4044d54d4f 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(&$a) {
+function dfrn_request_init(App &$a) {
 
        if($a->argc > 1)
                $which = $a->argv[1];
@@ -42,7 +42,7 @@ function dfrn_request_init(&$a) {
  * After logging in, we click 'submit' to approve the linkage.
  *
  */
-function dfrn_request_post(&$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(&$a) {
 }
 
 
-function dfrn_request_content(&$a) {
+function dfrn_request_content(App &$a) {
 
        if (($a->argc != 2) || (! count($a->profile))) {
                return "";
@@ -810,19 +810,17 @@ function dfrn_request_content(&$a) {
 
                // At first look if an address was provided
                // Otherwise take the local address
-               if (x($_GET,'addr') AND ($_GET['addr'] != ""))
+               if (x($_GET,'addr') AND ($_GET['addr'] != "")) {
                        $myaddr = hex2bin($_GET['addr']);
-               elseif (x($_GET,'address') AND ($_GET['address'] != ""))
+               } elseif (x($_GET,'address') AND ($_GET['address'] != "")) {
                        $myaddr = $_GET['address'];
-               elseif (local_user()) {
+               elseif (local_user()) {
                        if (strlen($a->path)) {
                                $myaddr = App::get_baseurl() . '/profile/' . $a->user['nickname'];
-                       }
-                       else {
+                       } else {
                                $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
                        }
-               }
-               else {
+               } else {
                        // last, try a zrl
                        $myaddr = get_my_url();
                }
@@ -840,8 +838,7 @@ function dfrn_request_content(&$a) {
 
                if ($a->profile['page-flags'] == PAGE_NORMAL) {
                        $tpl = get_markup_template('dfrn_request.tpl');
-               }
-               else {
+               } else {
                        $tpl = get_markup_template('auto_request.tpl');
                }
 
@@ -850,10 +847,12 @@ function dfrn_request_content(&$a) {
                // see if we are allowed to have NETWORK_MAIL2 contacts
 
                $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
-               if(get_config('system','dfrn_only'))
+
+               if (get_config('system','dfrn_only')) {
                        $mail_disabled = 1;
+               }
 
-               if(! $mail_disabled) {
+               if (! $mail_disabled) {
                        $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                intval($a->profile['uid'])
                        );
index 50a0a93b9ce454e50ec8b604ce5e205e172527ff..f3fbb9eb77cb7834af4a3d5f553e418dbefec160 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function directory_init(&$a) {
+function directory_init(App &$a) {
        $a->set_pager_itemspage(60);
 
        if(local_user()) {
@@ -20,14 +20,14 @@ function directory_init(&$a) {
 }
 
 
-function directory_post(&$a) {
+function directory_post(App &$a) {
        if(x($_POST,'search'))
                $a->data['search'] = $_POST['search'];
 }
 
 
 
-function directory_content(&$a) {
+function directory_content(App &$a) {
        global $db;
 
        require_once("mod/proxy.php");
index 0ac82f2817ea05b2ba6a9d2f7a31f92ffc3552ba..7eb830bb6896479dd12f0289bbfa60097552cd44 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(&$a) {
+function dirfind_init(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL );
index 6ebe16ae8ad7817e23869941f202c4b828b2b9fa..c98d936a0f45dd6c01676709d7cf88947406b59c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function display_init(&$a) {
+function display_init(App &$a) {
 
        if ((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
index 54b50bc36de5f1f7c1619e4fdebeb475d38308cc..a655801d7727ec11b60837fd3e2fbb4fcc76bc13 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/acl_selectors.php');
 
-function editpost_content(&$a) {
+function editpost_content(App &$a) {
 
        $o = '';
 
@@ -23,7 +23,7 @@ function editpost_content(&$a) {
                intval(local_user())
        );
 
-       if (! count($itm)) {
+       if (! dbm::is_result($itm)) {
                notice( t('Item not found') . EOL);
                return;
        }
index 36d8f0cf71efbc1254f287e8466cb4da6a447bd5..8281a97661321e797c7afaeafaad305d81f70c5a 100644 (file)
@@ -8,7 +8,7 @@ require_once('include/datetime.php');
 require_once('include/event.php');
 require_once('include/items.php');
 
-function events_init(&$a) {
+function events_init(App &$a) {
        if (! local_user()) {
                return;
        }
@@ -21,8 +21,9 @@ function events_init(&$a) {
 
                $cal_widget = widget_events();
 
-               if (! x($a->page,'aside'))
+               if (! x($a->page,'aside')) {
                        $a->page['aside'] = '';
+               }
 
                $a->page['aside'] .= $cal_widget;
        }
@@ -30,7 +31,7 @@ function events_init(&$a) {
        return;
 }
 
-function events_post(&$a) {
+function events_post(App &$a) {
 
        logger('post: ' . print_r($_REQUEST,true));
 
@@ -188,7 +189,7 @@ function events_post(&$a) {
 
 
 
-function events_content(&$a) {
+function events_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -353,7 +354,7 @@ function events_content(&$a) {
                        }
                }
 
-               $events=array();
+               $events = array();
 
                // transform the event in a usable array
                if (dbm::is_result($r)) {
index 9c1d43cd8bc606a89c688dd81b8d145986d38ba2..9c8d2169bae245080484c5cbffa5c7fd7dde82cb 100644 (file)
@@ -10,8 +10,7 @@ require_once('include/Photo.php');
 /**
  * @param App $a
  */
-/// @TODO & is missing or App ?
-function fbrowser_content($a){
+function fbrowser_content(App &$a){
 
        if (!local_user())
                killme();
index afb5b88af3dc223fbeb1db19f6e2bf95d3d0a230..64eac174ac1917ff5ec35aff2c83d39fb4761e5f 100644 (file)
@@ -8,7 +8,7 @@ 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(&$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 eac3260591a3a7d6b770adc933d05f6f94dc44b7..1b5589380b288e14a81e774558c1cdd6b767e866 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function filer_content(&$a) {
+function filer_content(App &$a) {
 
        if (! local_user()) {
                killme();
index d3d74a4c2f6b84c0e31e75c08b2877e24db5a845..7dbfe29473dd38b02e7c51c9769a9720ed6e106c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function filerm_content(&$a) {
+function filerm_content(App &$a) {
 
        if (! local_user()) {
                killme();
index 2e970ad0cb853f7092e42cf29ebd0215a901b92b..3ba33780ba944327cd2fa86a6a4ad88fc5c06120 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(&$a) {
+function follow_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -152,7 +152,7 @@ function follow_content(&$a) {
        return $o;
 }
 
-function follow_post(&$a) {
+function follow_post(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 5d8e43e6cb6ceec45b8f458d1403057bd43b1452..d79c89a6b24ec9ddb867c7f7cf73434b913ceeb1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function friendica_init(&$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(&$a) {
 
 
 
-function friendica_content(&$a) {
+function friendica_content(App &$a) {
 
        $o = '';
        $o .= '<h3>Friendica</h3>';
index 66871653ddff3f00c3a01fbd156c2038f61c0738..fcbadcc9b7f06a5febca3ee9167608f429f37086 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function fsuggest_post(&$a) {
+function fsuggest_post(App &$a) {
 
        if (! local_user()) {
                return;
@@ -71,7 +71,7 @@ function fsuggest_post(&$a) {
 
 
 
-function fsuggest_content(&$a) {
+function fsuggest_content(App &$a) {
 
        require_once('include/acl_selectors.php');
 
index 75ccc8f6d92908c506402cf4cbcda4987169d30c..681bc88cc3176af4f4f3b3c406787a9a41b379b5 100644 (file)
@@ -4,7 +4,7 @@ function validate_members(&$item) {
        $item = intval($item);
 }
 
-function group_init(&$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(&$a) {
 
 
 
-function group_post(&$a) {
+function group_post(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -31,8 +31,7 @@ function group_post(&$a) {
                        if ($r) {
                                goaway(App::get_baseurl() . '/group/' . $r);
                        }
-               }
-               else {
+               } else {
                        notice( t('Could not create group.') . EOL );
                }
                goaway(App::get_baseurl() . '/group');
@@ -70,7 +69,7 @@ function group_post(&$a) {
        return;
 }
 
-function group_content(&$a) {
+function group_content(App &$a) {
        $change = false;
 
        if (! local_user()) {
@@ -92,7 +91,7 @@ function group_content(&$a) {
                        '$submit' => t('Save Group'),
        );
 
-       if(($a->argc == 2) && ($a->argv[1] === 'new')) {
+       if (($a->argc == 2) && ($a->argv[1] === 'new')) {
 
                return replace_macros($tpl, $context + array(
                        '$title' => t('Create a group of contacts/friends.'),
index 512949f1a3645486313f302cec15c7aa336ab640..d53405009a6fda34ebadaf3e447c605223c76134 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function hcard_init(&$a) {
+function hcard_init(App &$a) {
 
        $blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
 
@@ -52,4 +52,3 @@ function hcard_init(&$a) {
        }
 
 }
-
index 0512e0f2e0d1839391e2e2c34f95e510030920f4..c2693dedba57103e318f59d50cbaf135e28c99ef 100644 (file)
@@ -18,7 +18,7 @@ if (!function_exists('load_doc_file')) {
 
 }
 
-function help_content(&$a) {
+function help_content(App &$a) {
 
        nav_set_selected('help');
 
index eb5d1e90b00f4ac31de6c8a36ce884cdce45d79a..ed66bad147470f3ca0857d41d5e094e3b110447c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 if(! function_exists('home_init')) {
-function home_init(&$a) {
+function home_init(App &$a) {
 
        $ret = array();
        call_hooks('home_init',$ret);
@@ -17,7 +17,7 @@ function home_init(&$a) {
 }}
 
 if(! function_exists('home_content')) {
-function home_content(&$a) {
+function home_content(App &$a) {
 
        $o = '';
 
index 647073b056e3774b1431ab98208ac5c486283275..d41d8448050b7befb8e670f2a2302b14f46edaae 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/crypto.php');
 
-function hostxrd_init(&$a) {
+function hostxrd_init(App &$a) {
        header('Access-Control-Allow-Origin: *');
        header("Content-type: text/xml");
        $pubkey = get_config('system','site_pubkey');
index 65b75b32112df4ab9954fd40664d040d54b4b004..553d5d2232f9116559b4f397c9ab01c112793599 100644 (file)
@@ -11,7 +11,7 @@
 require_once("include/socgraph.php");
 require_once("include/Contact.php");
 
-function hovercard_init(&$a) {
+function hovercard_init(App &$a) {
        // Just for testing purposes
        $_GET["mode"] = "minimal";
 }
index 5e8411e376743d630e30a75d8cf27a6e0ad40d3f..99b3a3ddcca3c486420d860336b0eeb5891f8734 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function ignored_init(&$a) {
+function ignored_init(App &$a) {
 
        $ignored = 0;
 
index b13da8c28f8c86d1a6d9b40a0cd2275e7894553d..382fcefd76a7564401fc16d3011fd10b0c9c9fa2 100755 (executable)
@@ -4,7 +4,7 @@ require_once "include/Photo.php";
 $install_wizard_pass=1;
 
 
-function install_init(&$a){
+function install_init(App &$a){
 
        // $baseurl/install/testrwrite to test if rewite in .htaccess is working
        if ($a->argc==2 && $a->argv[1]=="testrewrite") {
@@ -24,7 +24,7 @@ function install_init(&$a){
 
 }
 
-function install_post(&$a) {
+function install_post(App &$a) {
        global $install_wizard_pass, $db;
 
        switch($install_wizard_pass) {
@@ -132,7 +132,7 @@ function get_db_errno() {
        }
 }
 
-function install_content(&$a) {
+function install_content(App &$a) {
 
        global $install_wizard_pass, $db;
        $o = '';
@@ -565,7 +565,7 @@ function check_imagik(&$checks) {
        }
 }
 
-function manual_config(&$a) {
+function manual_config(App &$a) {
        $data = htmlentities($a->data['txt'],ENT_COMPAT,'UTF-8');
        $o = t('The database configuration file ".htconfig.php" could not be written. Please use the enclosed text to create a configuration file in your web server root.');
        $o .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
@@ -581,7 +581,6 @@ function load_database_rem($v, $i){
        }
 }
 
-
 function load_database($db) {
 
        require_once("include/dbstructure.php");
index 441d39e6e0900c6f0584d7d488d84495d6fdf93d..a7739fc774bf9b4b3fd812921f068ff0e942876b 100644 (file)
@@ -9,7 +9,7 @@
 
 require_once('include/email.php');
 
-function invite_post(&$a) {
+function invite_post(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -97,7 +97,7 @@ function invite_post(&$a) {
 }
 
 
-function invite_content(&$a) {
+function invite_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -120,7 +120,7 @@ function invite_content(&$a) {
        if (strlen($dirloc)) {
                if ($a->config['register_policy'] == REGISTER_CLOSED) {
                        $linktxt = sprintf( t('Visit %s for a list of public sites that you can join. Friendica members on other sites can all connect with each other, as well as with members of many other social networks.'), $dirloc . '/siteinfo');
-               } elseif($a->config['register_policy'] != REGISTER_CLOSED) {
+               } elseif ($a->config['register_policy'] != REGISTER_CLOSED) {
                        $linktxt = sprintf( t('To accept this invitation, please visit and register at %s or any other public Friendica website.'), App::get_baseurl())
                        . "\r\n" . "\r\n" . sprintf( t('Friendica sites all inter-connect to create a huge privacy-enhanced social web that is owned and controlled by its members. They can also connect with many traditional social networks. See %s for a list of alternate Friendica sites you can join.'),$dirloc . '/siteinfo');
                }
index 9e38382cc38d4af6d3f6184dcfae4e5a3ea1730e..1c7a970c2da2eda04026e624bbdc35494ab826ad 100644 (file)
@@ -27,7 +27,7 @@ require_once('include/Scrape.php');
 require_once('include/diaspora.php');
 require_once('include/Contact.php');
 
-function item_post(&$a) {
+function item_post(App &$a) {
 
        if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter')))
                return;
@@ -138,7 +138,7 @@ function item_post(&$a) {
 
                        // If the contact id doesn't fit with the contact, then set the contact to null
                        $thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
-                       if (count($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
+                       if (dbm::is_result($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
                                AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
                                $parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]);
 
@@ -218,8 +218,9 @@ function item_post(&$a) {
                        intval($profile_uid),
                        intval($post_id)
                );
-               if(! count($i))
+               if (! dbm::is_result($i)) {
                        killme();
+               }
                $orig_post = $i[0];
        }
 
@@ -605,16 +606,17 @@ function item_post(&$a) {
                                continue;
 
                        $success = handle_tag($a, $body, $inform, $str_tags, (local_user()) ? local_user() : $profile_uid , $tag, $network);
-                       if($success['replaced'])
+                       if ($success['replaced']) {
                                $tagged[] = $tag;
-                       if(is_array($success['contact']) && intval($success['contact']['prv'])) {
+                       }
+                       if (is_array($success['contact']) && intval($success['contact']['prv'])) {
                                $private_forum = true;
                                $private_id = $success['contact']['id'];
                        }
                }
        }
 
-       if(($private_forum) && (! $parent) && (! $private)) {
+       if (($private_forum) && (! $parent) && (! $private)) {
                // we tagged a private forum in a top level post and the message was public.
                // Restrict it.
                $private = 1;
@@ -624,8 +626,8 @@ function item_post(&$a) {
        $attachments = '';
        $match = false;
 
-       if(preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
-               foreach($match[2] as $mtch) {
+       if (preg_match_all('/(\[attachment\]([0-9]+)\[\/attachment\])/',$body,$match)) {
+               foreach ($match[2] as $mtch) {
                        $r = q("SELECT `id`,`filename`,`filesize`,`filetype` FROM `attach` WHERE `uid` = %d AND `id` = %d LIMIT 1",
                                intval($profile_uid),
                                intval($mtch)
@@ -1064,7 +1066,7 @@ function item_post_return($baseurl, $api_source, $return_path) {
 
 
 
-function item_content(&$a) {
+function item_content(App &$a) {
 
        if ((! local_user()) && (! remote_user())) {
                return;
index cbab9185e4dceec2b79a5e81bb3c2b6d10065d57..ff1e238ac180b9c104f1b2a85c630fac3842b275 100755 (executable)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 require_once('include/like.php');
 
-function like_content(&$a) {
+function like_content(App &$a) {
        if(! local_user() && ! remote_user()) {
                return false;
        }
index ce6bf84a122226b4187ef8ba4c296490b1fe848a..00a7c59094ef6313ecf992476fe9be37e4235e20 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/datetime.php');
 
 
-function localtime_post(&$a) {
+function localtime_post(App &$a) {
 
        $t = $_REQUEST['time'];
        if(! $t)
@@ -16,7 +16,7 @@ function localtime_post(&$a) {
 
 }
 
-function localtime_content(&$a) {
+function localtime_content(App &$a) {
        $t = $_REQUEST['time'];
        if(! $t)
                $t = 'now';
index 68b5d30cfeffd878f97034cdab626845c33c15e6..746df28cd9478bbbef134dbbe8a797c3c8a0750c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function lockview_content(&$a) {
+function lockview_content(App &$a) {
   
        $type = (($a->argc > 1) ? $a->argv[1] : 0);
        if (is_numeric($type)) {
index d09fc1868f55adb2525f734666abeae77c22be38..db49ba20ac50dda49c9e53b8f5e3de734c9efb50 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function login_content(&$a) {
+function login_content(App &$a) {
        if(x($_SESSION,'theme'))
                unset($_SESSION['theme']);
        if(x($_SESSION,'mobile-theme'))
index a5ef739cd197564b1e72f9090586009decaa908b..f9e9400fc2caf47318c49be9babe156a5f3a159e 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/email.php');
 require_once('include/enotify.php');
 require_once('include/text.php');
 
-function lostpass_post(&$a) {
+function lostpass_post(App &$a) {
 
        $loginame = notags(trim($_POST['login-name']));
        if(! $loginame)
@@ -77,7 +77,7 @@ function lostpass_post(&$a) {
 }
 
 
-function lostpass_content(&$a) {
+function lostpass_content(App &$a) {
 
 
        if(x($_GET,'verify')) {
@@ -102,6 +102,8 @@ function lostpass_content(&$a) {
                        dbesc($new_password_encoded),
                        intval($uid)
                );
+
+               /// @TODO Is dbm::is_result() okay here?
                if ($r) {
                        $tpl = get_markup_template('pwdreset.tpl');
                        $o .= replace_macros($tpl,array(
index 3d21ce40b759d6b28e7b51e8396daf9bcc91aee6..ce432f9307b4ba26c4c51fb9ab32f33a3b9e0417 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function maintenance_content(&$a) {
+function maintenance_content(App &$a) {
        header('HTTP/1.1 503 Service Temporarily Unavailable');
        header('Status: 503 Service Temporarily Unavailable');
        header('Retry-After: 600');
index bb9dfc313cf275ca68eb28055e2aca50649ed0ba..835a7fbcb7b781c0ad988692d3a2a702494417c8 100644 (file)
@@ -3,7 +3,7 @@
 require_once("include/text.php");
 
 
-function manage_post(&$a) {
+function manage_post(App &$a) {
 
        if (! local_user()) {
                return;
@@ -92,7 +92,7 @@ function manage_post(&$a) {
 
 
 
-function manage_content(&$a) {
+function manage_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index a9535d2d669a19868324a57645b1abc4a4c5ffb6..f7274e436666e727f0cd57c3d2c3c0964dfbf2a8 100644 (file)
@@ -13,7 +13,7 @@ require_once('mod/proxy.php');
  * @param App &$a
  * @return void|string
  */
-function match_content(&$a) {
+function match_content(App &$a) {
 
        $o = '';
        if (! local_user()) {
index fcf0989ae0773e31fd261536fb276c1a34b18688..776a23bccdced6baec9f83b64185c860473ee9b8 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/acl_selectors.php');
 require_once('include/message.php');
 require_once('include/Smilies.php');
 
-function message_init(&$a) {
+function message_init(App &$a) {
 
        $tabs = '';
 
@@ -40,7 +40,7 @@ function message_init(&$a) {
 
 }
 
-function message_post(&$a) {
+function message_post(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
@@ -173,7 +173,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
 
 
 
-function message_content(&$a) {
+function message_content(App &$a) {
 
        $o = '';
        nav_set_selected('messages');
@@ -364,7 +364,7 @@ function message_content(&$a) {
 
        $_SESSION['return_url'] = $a->query_string;
 
-       if($a->argc == 1) {
+       if ($a->argc == 1) {
 
                // List messages
 
index 3729e3236cc2460989031b62c83ca91963432514..5fc7012909e30b8a9380dd873cb66738abd2d005 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('library/asn1.php');
 
-function modexp_init(&$a) {
+function modexp_init(App &$a) {
 
        if($a->argc != 2)
                killme();
index ec318f85fd8e95bcc376d614dbb3a80514bb3ecc..0e603c869a110e5155819b611a42c2bf58f4102c 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function mood_init(&$a) {
+function mood_init(App &$a) {
 
        if (! local_user()) {
                return;
@@ -109,7 +109,7 @@ function mood_init(&$a) {
 
 
 
-function mood_content(&$a) {
+function mood_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index ba7a92d64e26fa697043b4d1e230d1bea38cc278..4b5205ac0848d937fb9c1d337eeeeac8bcbf1a29 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function msearch_post(&$a) {
+function msearch_post(App &$a) {
 
        $perpage = (($_POST['n']) ? $_POST['n'] : 80);
        $page = (($_POST['p']) ? intval($_POST['p'] - 1) : 0);
index cba950a431739ba6be394c12e46f2bdbf62d2606..d69c76a843513e810d10db9b31f10d72d14aed9d 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once("include/nav.php");
 
-function navigation_content(&$a) {
+function navigation_content(App &$a) {
 
        $nav_info = nav_info($a);
 
index cce511ae19ff66238e2112280effd1274d892d11..61df38fb12b69b4f2a75c2bf3dec1862b5a23b68 100644 (file)
@@ -1,17 +1,18 @@
 <?php
-function network_init(&$a) {
+function network_init(App &$a) {
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
                return;
        }
 
        $is_a_date_query = false;
-       if(x($_GET['cid']) && intval($_GET['cid']) != 0)
+       if (x($_GET['cid']) && intval($_GET['cid']) != 0) {
                $cid = $_GET['cid'];
+       }
 
-       if($a->argc > 1) {
-               for($x = 1; $x < $a->argc; $x ++) {
-                       if(is_a_date_arg($a->argv[$x])) {
+       if ($a->argc > 1) {
+               for ($x = 1; $x < $a->argc; $x ++) {
+                       if (is_a_date_arg($a->argv[$x])) {
                                $is_a_date_query = true;
                                break;
                        }
@@ -24,9 +25,8 @@ function network_init(&$a) {
        parse_str($query_string, $query_array);
        array_shift($query_array);
 
-
        // fetch last used network view and redirect if needed
-       if(! $is_a_date_query) {
+       if (! $is_a_date_query) {
                $sel_tabs = network_query_get_sel_tab($a);
                $sel_nets = network_query_get_sel_net();
                $sel_groups = network_query_get_sel_group($a);
@@ -41,10 +41,9 @@ function network_init(&$a) {
                $net_baseurl = '/network';
                $net_args = array();
 
-               if($remember_group) {
+               if ($remember_group) {
                        $net_baseurl .= '/' . $last_sel_groups; // Note that the group number must come before the "/new" tab selection
-               }
-               else if($sel_groups !== false) {
+               } elseif($sel_groups !== false) {
                        $net_baseurl .= '/' . $sel_groups;
                }
 
@@ -222,7 +221,7 @@ function saved_searches($search) {
  *
  * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active );
  */
-function network_query_get_sel_tab($a) {
+function network_query_get_sel_tab(App &$a) {
        $no_active='';
        $starred_active = '';
        $new_active = '';
@@ -293,7 +292,7 @@ function network_query_get_sel_net() {
        return $network;
 }
 
-function network_query_get_sel_group($a) {
+function network_query_get_sel_group(App &$a) {
        $group = false;
 
        if($a->argc >= 2 && is_numeric($a->argv[1])) {
@@ -810,7 +809,7 @@ function network_content(&$a, $update = 0) {
  * @param app $a The global App
  * @return string Html of the networktab
  */
-function network_tabs($a) {
+function network_tabs(App &$a) {
        // item filter tabs
        /// @TODO fix this logic, reduce duplication
        /// $a->page['content'] .= '<div class="tabs-wrapper">';
index aa55c3a098804f7e77e696e07167ecf35c9c7ad1..1ef0985066e1971bdedee1e4a2ba80b02aeb2297 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function newmember_content(&$a) {
+function newmember_content(App &$a) {
 
 
        $o = '<h1>' . t('Welcome to Friendica') . '</h1>';
index e55dba128f961071a3705e9a1543846d01d5446f..104fecb755ddc21ea1ad118ffaaeecc84b603700 100644 (file)
@@ -7,7 +7,7 @@
 
 require_once("include/plugin.php");
 
-function nodeinfo_wellknown(&$a) {
+function nodeinfo_wellknown(App &$a) {
        if (!get_config("system", "nodeinfo")) {
                http_status_exit(404);
                killme();
@@ -20,7 +20,7 @@ function nodeinfo_wellknown(&$a) {
        exit;
 }
 
-function nodeinfo_init(&$a){
+function nodeinfo_init(App &$a){
        if (!get_config("system", "nodeinfo")) {
                http_status_exit(404);
                killme();
index c75b595c363967f6fbfe0324117b288818e31415..c44840627739437ce31dc19a7773e0ee5dc3a3ec 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/Contact.php');
 require_once('include/socgraph.php');
 require_once('include/contact_selectors.php');
 
-function nogroup_init(&$a) {
+function nogroup_init(App &$a) {
 
        if (! local_user()) {
                return;
@@ -21,7 +21,7 @@ function nogroup_init(&$a) {
 }
 
 
-function nogroup_content(&$a) {
+function nogroup_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 3d298cfe3961b436d710b4e3d897cf59b2fe793f..758ce8ba5316f1b889d605543d48892629a5aa43 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function noscrape_init(&$a) {
+function noscrape_init(App &$a) {
 
        if($a->argc > 1)
                $which = $a->argv[1];
index d9222dca5104a41b8f57c4794f228330cf5c5c1b..b2aa5487af963e60d1b456dbf39ec1b258b20aea 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function notes_init(&$a) {
+function notes_init(App &$a) {
 
        if (! local_user()) {
                return;
index 71c4977be9bf378dff0ad65aeb076d360e9223b7..e338d8752d5485c6d96bd886897579d2570f27c0 100644 (file)
@@ -1,7 +1,7 @@
 <?php
        /* identi.ca -> friendica items permanent-url compatibility */
        
-       function notice_init(&$a){
+       function notice_init(App &$a){
                $id = $a->argv[1];
                $r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
                                intval($id)
index ed15f14177a45d4b2b1d94f530eeb7eb6f87e4ef..47e4cd03405f867f2560f5588f3fd4fa3ac5b840 100644 (file)
@@ -9,7 +9,7 @@ require_once("include/NotificationsManager.php");
 require_once("include/contact_selectors.php");
 require_once("include/network.php");
 
-function notifications_post(&$a) {
+function notifications_post(App &$a) {
 
        if (! local_user()) {
                goaway(z_root());
@@ -65,7 +65,7 @@ function notifications_post(&$a) {
        }
 }
 
-function notifications_content(&$a) {
+function notifications_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 88f5fa5429c2d170d86a748788a94e17b75bccaf..bd7a7faf495d72e13571455172711c86ba0cc0b3 100644 (file)
@@ -1,8 +1,7 @@
 <?php
 require_once('include/NotificationsManager.php');
 
-
-function notify_init(&$a) {
+function notify_init(App &$a) {
        if (! local_user()) {
                return;
        }
@@ -40,7 +39,7 @@ function notify_init(&$a) {
 
 }
 
-function notify_content(&$a) {
+function notify_content(App &$a) {
        if (! local_user()) {
                return login();
        }
index cb478cb8605d7054133a6e9ab371e2dbb9187d9b..1d6e6145cd35cd0c873dec999f59429d2ed59d23 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once("include/oembed.php");
 
-function oembed_content(&$a){
+function oembed_content(App &$a){
        // logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
 
        if ($a->argv[1]=='b2h'){
index 6eb380dff4cc3da49557548e2ad6b08dde9e359a..49c5d01f4504fb33e4f6d40186b2f87f0529149b 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function oexchange_init(&$a) {
+function oexchange_init(App &$a) {
 
        if(($a->argc > 1) && ($a->argv[1] === 'xrd')) {
                $tpl = get_markup_template('oexchange_xrd.tpl');
@@ -14,7 +14,7 @@ function oexchange_init(&$a) {
 
 }
 
-function oexchange_content(&$a) {
+function oexchange_content(App &$a) {
 
        if (! local_user()) {
                $o = login(false);
index 09905198c971f6c554fa5b2ccf04aba4d4e7c30d..ce707c4150b1195dd84572bf79cacc99cc7221de 100644 (file)
@@ -4,7 +4,7 @@
 require_once('library/openid.php');
 
 
-function openid_content(&$a) {
+function openid_content(App &$a) {
 
        $noid = get_config('system','no_openid');
        if($noid)
index 50ecc4e69efbe2bbb7663a6f862a98d28968994d..1a7d4cd30715bff0b23d91ba4bbfcd42158b4ab7 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-    function opensearch_content(&$a) {
+    function opensearch_content(App &$a) {
        
                $tpl = get_markup_template('opensearch.tpl');
        
index 04c8d7bde79e841de8c8f5724f503e7a4adfa0c4..b2f536e6df310a2f0962a3b2a66cb1215f200562 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/Scrape.php');
 require_once('include/follow.php');
 
-function ostatus_subscribe_content(&$a) {
+function ostatus_subscribe_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 410e0877377ef9291cbf0ae7b016c6a8204a3ea8..44cf80935e2bd237aa437a55969c82c1f2823c84 100644 (file)
@@ -19,7 +19,7 @@ use \Friendica\ParseUrl;
 
 require_once("include/items.php");
 
-function parse_url_content(&$a) {
+function parse_url_content(App &$a) {
 
        $text = null;
        $str_tags = "";
index a94a3ac2ce57eb97f260689e6cb699b2766ce94f..9744b9f239b246a595f3b722b7e4e7c5dda13c39 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/security.php');
 require_once('include/Photo.php');
 
-function photo_init(&$a) {
+function photo_init(App &$a) {
        global $_SERVER;
 
        $prvcachecontrol = false;
index e026944423491748732f7a02a25e4c8c376513bf..b451535e42aff45812cc5b15915d7cbe5e7594da 100644 (file)
@@ -10,7 +10,7 @@ require_once('include/tags.php');
 require_once('include/threads.php');
 require_once('include/Probe.php');
 
-function photos_init(&$a) {
+function photos_init(App &$a) {
 
        if ($a->argc > 1)
                auto_redir($a, $a->argv[1]);
@@ -112,7 +112,7 @@ function photos_init(&$a) {
 
 
 
-function photos_post(&$a) {
+function photos_post(App &$a) {
 
        logger('mod-photos: photos_post: begin' , LOGGER_DEBUG);
 
@@ -353,7 +353,7 @@ function photos_post(&$a) {
                                dbesc($r[0]['resource-id']),
                                intval($page_owner_uid)
                        );
-                       if (count($i)) {
+                       if (dbm::is_result($i)) {
                                q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
                                        dbesc(datetime_convert()),
                                        dbesc(datetime_convert()),
@@ -945,7 +945,7 @@ function photos_post(&$a) {
 
 
 
-function photos_content(&$a) {
+function photos_content(App &$a) {
 
        // URLs:
        // photos/name
index a97ca64e3352c8076cb6d778e918252aa3efd032..0415e1a2ceb919d05220320416edb0cd2c3b1c53 100644 (file)
@@ -2,7 +2,7 @@
 // See here for a documentation for portable contacts:
 // https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
 
-function poco_init(&$a) {
+function poco_init(App &$a) {
        require_once("include/bbcode.php");
 
        $system_mode = false;
@@ -16,8 +16,9 @@ function poco_init(&$a) {
        }
        if(! x($user)) {
                $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
-               if(! count($c))
+               if (! dbm::is_result($c)) {
                        http_status_exit(401);
+               }
                $system_mode = true;
        }
 
index af8eed35a089a54f6bd2520e8af5ae12e4ecd28c..2e15ed853ff395be7363279c8d9499871d3348a4 100644 (file)
@@ -19,7 +19,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function poke_init(&$a) {
+function poke_init(App &$a) {
 
        if (! local_user()) {
                return;
@@ -148,7 +148,7 @@ function poke_init(&$a) {
 
 
 
-function poke_content(&$a) {
+function poke_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index a8d345ecb6c7af48e85454db79314259eb5e66e9..076587839d96765577d270403dbfb9e4c7ae96ae 100644 (file)
@@ -10,11 +10,11 @@ require_once('include/crypto.php');
 // not yet ready for prime time
 //require_once('include/zot.php');
        
-function post_post(&$a) {
+function post_post(App &$a) {
 
        $bulk_delivery = false;
 
-       if($a->argc == 1) {
+       if ($a->argc == 1) {
                $bulk_delivery = true;
        }
        else {
index 4584cb29e2564cd31963438d08b295d09c140ecb..694fd5ba2796a6f6ea19dcafcf7e75a1feeb9764 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function pretheme_init(&$a) {
+function pretheme_init(App &$a) {
        
        if($_REQUEST['theme']) {
                $theme = $_REQUEST['theme'];
index c95db291b359a8410597ceb08d508826441e00cd..c368a50f584be647e332b41c761144be32c0a291 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/Scrape.php');
 
-function probe_content(&$a) {
+function probe_content(App &$a) {
 
        $o .= '<h3>Probe Diagnostic</h3>';
 
index ae8f2fa720699762c125329efae95f484f3f7628..32d3985b7f844f11bd4618290a965af737bd8ab0 100644 (file)
@@ -4,7 +4,7 @@ require_once('include/contact_widgets.php');
 require_once('include/redir.php');
 
 
-function profile_init(&$a) {
+function profile_init(App &$a) {
 
        if(! x($a->page,'aside'))
                $a->page['aside'] = '';
@@ -41,14 +41,15 @@ function profile_init(&$a) {
        if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) {
                $a->page['htmlhead'] .= '<meta name="friendica.community" content="true" />';
        }
-       if(x($a->profile,'openidserver'))
+       if (x($a->profile,'openidserver')) {
                $a->page['htmlhead'] .= '<link rel="openid.server" href="' . $a->profile['openidserver'] . '" />' . "\r\n";
-       if(x($a->profile,'openid')) {
+       }
+       if (x($a->profile,'openid')) {
                $delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'https://' . $a->profile['openid']);
                $a->page['htmlhead'] .= '<link rel="openid.delegate" href="' . $delegate . '" />' . "\r\n";
        }
        // site block
-       if((! $blocked) && (! $userblock)) {
+       if ((! $blocked) && (! $userblock)) {
                $keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
                $keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$keywords);
                if(strlen($keywords))
@@ -74,24 +75,25 @@ function profile_content(&$a, $update = 0) {
 
        $category = $datequery = $datequery2 = '';
 
-       if($a->argc > 2) {
-               for($x = 2; $x < $a->argc; $x ++) {
-                       if(is_a_date_arg($a->argv[$x])) {
-                               if($datequery)
+       if ($a->argc > 2) {
+               for ($x = 2; $x < $a->argc; $x ++) {
+                       if (is_a_date_arg($a->argv[$x])) {
+                               if ($datequery) {
                                        $datequery2 = escape_tags($a->argv[$x]);
-                               else
+                               } else {
                                        $datequery = escape_tags($a->argv[$x]);
-                       }
-                       else
+                               }
+                       } else {
                                $category = $a->argv[$x];
+                       }
                }
        }
 
-       if(! x($category)) {
+       if (! x($category)) {
                $category = ((x($_GET,'category')) ? $_GET['category'] : '');
        }
 
-       if(get_config('system','block_public') && (! local_user()) && (! remote_user())) {
+       if (get_config('system','block_public') && (! local_user()) && (! remote_user())) {
                return login();
        }
 
@@ -106,32 +108,28 @@ function profile_content(&$a, $update = 0) {
        $tab = 'posts';
        $o = '';
 
-       if($update) {
+       if ($update) {
                // Ensure we've got a profile owner if updating.
                $a->profile['profile_uid'] = $update;
+       } elseif ($a->profile['profile_uid'] == local_user()) {
+               nav_set_selected('home');
        }
-       else {
-               if($a->profile['profile_uid'] == local_user()) {
-                       nav_set_selected('home');
-               }
-       }
-
 
        $contact = null;
        $remote_contact = false;
 
        $contact_id = 0;
 
-       if(is_array($_SESSION['remote'])) {
-               foreach($_SESSION['remote'] as $v) {
-                       if($v['uid'] == $a->profile['profile_uid']) {
+       if (is_array($_SESSION['remote'])) {
+               foreach ($_SESSION['remote'] as $v) {
+                       if ($v['uid'] == $a->profile['profile_uid']) {
                                $contact_id = $v['cid'];
                                break;
                        }
                }
        }
 
-       if($contact_id) {
+       if ($contact_id) {
                $groups = init_groups_visitor($contact_id);
                $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        intval($contact_id),
@@ -143,8 +141,8 @@ function profile_content(&$a, $update = 0) {
                }
        }
 
-       if(! $remote_contact) {
-               if(local_user()) {
+       if (! $remote_contact) {
+               if (local_user()) {
                        $contact_id = $_SESSION['cid'];
                        $contact = $a->contact;
                }
@@ -152,32 +150,29 @@ function profile_content(&$a, $update = 0) {
 
        $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
 
-       if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
+       if ($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
                notice( t('Access to this profile has been restricted.') . EOL);
                return;
        }
 
-       if(! $update) {
-
-
-               if(x($_GET,'tab'))
+       if (! $update) {
+               if (x($_GET,'tab')) {
                        $tab = notags(trim($_GET['tab']));
+               }
 
                $o.=profile_tabs($a, $is_owner, $a->profile['nickname']);
 
-
-               if($tab === 'profile') {
+               if ($tab === 'profile') {
                        $o .= advanced_profile($a);
                        call_hooks('profile_advanced',$o);
                        return $o;
                }
 
-
                $o .= common_friends_visitor_widget($a->profile['profile_uid']);
 
-
-               if(x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner)
+               if (x($_SESSION,'new_member') && $_SESSION['new_member'] && $is_owner) {
                        $o .= '<a href="newmember" id="newmember-tips" style="font-size: 1.2em;"><b>' . t('Tips for New Members') . '</b></a>' . EOL;
+               }
 
                $commpage = (($a->profile['page-flags'] == PAGE_COMMUNITY) ? true : false);
                $commvisitor = (($commpage && $remote_contact == true) ? true : false);
@@ -185,7 +180,7 @@ function profile_content(&$a, $update = 0) {
                $a->page['aside'] .= posted_date_widget(App::get_baseurl(true) . '/profile/' . $a->profile['nickname'],$a->profile['profile_uid'],true);
                $a->page['aside'] .= categories_widget(App::get_baseurl(true) . '/profile/' . $a->profile['nickname'],(x($category) ? xmlify($category) : ''));
 
-               if(can_write_wall($a,$a->profile['profile_uid'])) {
+               if (can_write_wall($a,$a->profile['profile_uid'])) {
 
                        $x = array(
                                'is_owner' => $is_owner,
@@ -204,18 +199,16 @@ function profile_content(&$a, $update = 0) {
 
                $o .= status_editor($a,$x);
                }
-
        }
 
 
        /**
         * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups
         */
-
        $sql_extra = item_permissions_sql($a->profile['profile_uid'],$remote_contact,$groups);
 
 
-       if($update) {
+       if ($update) {
 
                $r = q("SELECT distinct(parent) AS `item_id`, `item`.`network` AS `item_network`
                        FROM `item` INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
@@ -234,16 +227,16 @@ function profile_content(&$a, $update = 0) {
        } else {
                $sql_post_table = "";
 
-               if(x($category)) {
+               if (x($category)) {
                        $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
                                dbesc(protect_sprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($a->profile['profile_uid']));
                        //$sql_extra .= protect_sprintf(file_tag_file_query('item',$category,'category'));
                }
 
-               if($datequery) {
+               if ($datequery) {
                        $sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` <= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery))));
                }
-               if($datequery2) {
+               if ($datequery2) {
                        $sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
                }
 
index eee15c2af29e526bed6efb7b51076055300e2af3..c600dd1f868426c9759a89df47778540986c310a 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once("include/Photo.php");
 
-function profile_photo_init(&$a) {
+function profile_photo_init(App &$a) {
 
        if (! local_user()) {
                return;
@@ -13,7 +13,7 @@ function profile_photo_init(&$a) {
 }
 
 
-function profile_photo_post(&$a) {
+function profile_photo_post(App &$a) {
 
        if (! local_user()) {
                notice ( t('Permission denied.') . EOL );
@@ -73,22 +73,25 @@ function profile_photo_post(&$a) {
 
                                $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 4, $is_default_profile);
 
-                               if($r === false)
+                               if ($r === false) {
                                        notice ( sprintf(t('Image size reduction [%s] failed.'),"175") . EOL );
+                               }
 
                                $im->scaleImage(80);
 
                                $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 5, $is_default_profile);
 
-                               if($r === false)
+                               if ($r === false) {
                                        notice( sprintf(t('Image size reduction [%s] failed.'),"80") . EOL );
+                               }
 
                                $im->scaleImage(48);
 
                                $r = $im->store(local_user(), 0, $base_image['resource-id'],$base_image['filename'], t('Profile Photos'), 6, $is_default_profile);
 
-                               if($r === false)
+                               if ($r === false) {
                                        notice( sprintf(t('Image size reduction [%s] failed.'),"48") . EOL );
+                               }
 
                                // If setting for the default profile, unset the profile photo flag from any other photos I own
 
@@ -130,9 +133,9 @@ function profile_photo_post(&$a) {
 
                                require_once('include/profile_update.php');
                                profile_change();
-                       }
-                       else
+                       } else {
                                notice( t('Unable to process image') . EOL);
+                       }
                }
 
                goaway(App::get_baseurl() . '/profiles');
@@ -143,11 +146,13 @@ function profile_photo_post(&$a) {
        $filename = basename($_FILES['userfile']['name']);
        $filesize = intval($_FILES['userfile']['size']);
        $filetype = $_FILES['userfile']['type'];
-    if ($filetype=="") $filetype=guess_image_type($filename);
-    
+       if ($filetype == "") {
+               $filetype = guess_image_type($filename);
+       }
+
        $maximagesize = get_config('system','maximagesize');
 
-       if(($maximagesize) && ($filesize > $maximagesize)) {
+       if (($maximagesize) && ($filesize > $maximagesize)) {
                notice( sprintf(t('Image exceeds size limit of %s'), formatBytes($maximagesize)) . EOL);
                @unlink($src);
                return;
@@ -156,7 +161,7 @@ function profile_photo_post(&$a) {
        $imagedata = @file_get_contents($src);
        $ph = new Photo($imagedata, $filetype);
 
-       if(! $ph->is_valid()) {
+       if (! $ph->is_valid()) {
                notice( t('Unable to process image.') . EOL );
                @unlink($src);
                return;
@@ -165,12 +170,11 @@ function profile_photo_post(&$a) {
        $ph->orient($src);
        @unlink($src);
        return profile_photo_crop_ui_head($a, $ph);
-       
 }
 
 
 if(! function_exists('profile_photo_content')) {
-function profile_photo_content(&$a) {
+function profile_photo_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL );
@@ -282,15 +286,17 @@ function profile_photo_content(&$a) {
 if(! function_exists('profile_photo_crop_ui_head')) {
 function profile_photo_crop_ui_head(&$a, $ph){
        $max_length = get_config('system','max_image_length');
-       if(! $max_length)
+       if (! $max_length) {
                $max_length = MAX_IMAGE_LENGTH;
-       if($max_length > 0)
+       }
+       if ($max_length > 0) {
                $ph->scaleImage($max_length);
+       }
 
        $width = $ph->getWidth();
        $height = $ph->getHeight();
 
-       if($width < 175 || $height < 175) {
+       if ($width < 175 || $height < 175) {
                $ph->scaleImageUp(200);
                $width = $ph->getWidth();
                $height = $ph->getHeight();
@@ -303,19 +309,21 @@ function profile_photo_crop_ui_head(&$a, $ph){
 
        $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 0 );   
 
-       if($r)
+       if ($r) {
                info( t('Image uploaded successfully.') . EOL );
-       else
+       } else {
                notice( t('Image upload failed.') . EOL );
+       }
 
-       if($width > 640 || $height > 640) {
+       if ($width > 640 || $height > 640) {
                $ph->scaleImage(640);
                $r = $ph->store(local_user(), 0 , $hash, $filename, t('Profile Photos'), 1 );   
-               
-               if($r === false)
+
+               if ($r === false) {
                        notice( sprintf(t('Image size reduction [%s] failed.'),"640") . EOL );
-               else
+               } else {
                        $smallest = 1;
+               }
        }
 
        $a->config['imagecrop'] = $hash;
index 9321aacb5928984f26e867b88691b2b0b3fc8866..bf2f20d2a9bb63c2d403e78098a3eb06b78d1a00 100644 (file)
@@ -2,7 +2,7 @@
 require_once("include/Contact.php");
 require_once('include/Probe.php');
 
-function profiles_init(&$a) {
+function profiles_init(App &$a) {
 
        nav_set_selected('profiles');
 
@@ -92,7 +92,7 @@ function profiles_init(&$a) {
                        intval(local_user()),
                        intval($a->argv[2])
                );
-               if(! count($r1)) {
+               if(! dbm::is_result($r1)) {
                        notice( t('Profile unavailable to clone.') . EOL);
                        killme();
                        return;
@@ -116,7 +116,7 @@ function profiles_init(&$a) {
                        dbesc($name)
                );
                info( t('New profile created.') . EOL);
-               if(count($r3) == 1)
+               if ((dbm::is_result($r3)) && (count($r3) == 1))
                        goaway('profiles/'.$r3[0]['id']);
 
                goaway('profiles');
@@ -160,7 +160,7 @@ function profile_clean_keywords($keywords) {
        return $keywords;
 }
 
-function profiles_post(&$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(&$a) {
+function profiles_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 0a4b3e9a470697555d1def50a565f3dbaf75c9b4..bbb055b021c382e639dd5e50d20cb5b29419bd70 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function profperm_init(&$a) {
+function profperm_init(App &$a) {
 
        if (! local_user()) {
                return;
@@ -14,7 +14,7 @@ function profperm_init(&$a) {
 }
 
 
-function profperm_content(&$a) {
+function profperm_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied') . EOL);
index ea7e1000bade84bfde27357ba359fd5f75bd83d1..308e237d5d55bbebe91e12e36a927184bfaf6177 100644 (file)
@@ -26,7 +26,7 @@ function hub_post_return() {
 
 
 
-function pubsub_init(&$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 );
@@ -98,7 +98,7 @@ function pubsub_init(&$a) {
 
 require_once('include/security.php');
 
-function pubsub_post(&$a) {
+function pubsub_post(App &$a) {
 
        $xml = file_get_contents('php://input');
 
index bfe553c44caf1e8c91b5ee7cc74f1e2167fe3408..a6c36631aefa5fb77a6d383d2a39d1cff23156f3 100644 (file)
@@ -4,7 +4,7 @@ function post_var($name) {
        return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
 }
 
-function pubsubhubbub_init(&$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 b976e1a585acf3c4269cc9ac69a19f518a8b8e0c..118c93d9fa31a3d75d8508237a2f3869beed27e8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function qsearch_init(&$a) {
+function qsearch_init(App &$a) {
 
        if (! local_user()) {
                killme();
index b208eeef29421a6484778248daaeb6cedfd9e776..08157a3851a40ff8bba7723112498a817c90de21 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function randprof_init(&$a) {
+function randprof_init(App &$a) {
        require_once('include/Contact.php');
 
        $x = random_profile();
index 87fd79363582b5ab5c314f84d73d84e91592db3c..ec46ee742e24d3268d19f0cf68cc8d371c40b8e1 100644 (file)
@@ -10,7 +10,7 @@ require_once('include/crypto.php');
 require_once('include/diaspora.php');
 
 
-function receive_post(&$a) {
+function receive_post(App &$a) {
 
 
        $enabled = intval(get_config('system','diaspora_enabled'));
index be5e0c593325fabdf61931e0ee10b3770d7492cb..e951b2d2a9871251c7256ccff4b7f60b8c5e7206 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function redir_init(&$a) {
+function redir_init(App &$a) {
 
        $url = ((x($_GET,'url')) ? $_GET['url'] : '');
        $quiet = ((x($_GET,'quiet')) ? '&quiet=1' : '');
index 36ca18948409cbca1bf0c8107c0b57640c2db167..dd953de35619119cb7a7d898a4e11f974bec9452 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/user.php');
 
 if(! function_exists('register_post')) {
-function register_post(&$a) {
+function register_post(App &$a) {
 
        global $lang;
 
@@ -172,7 +172,7 @@ function register_post(&$a) {
 
 
 if(! function_exists('register_content')) {
-function register_content(&$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 34d29a77cecfee8360b9d2e63822876483a47e41..44bdfe66449029aa9bc1b6380afcb44f8ff6fa10 100644 (file)
@@ -12,15 +12,17 @@ function user_allow($hash) {
        );
 
 
-       if(! count($register))
+       if (! dbm::is_result($register)) {
                return false;
+       }
 
        $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
                intval($register[0]['uid'])
        );
 
-       if(! count($user))
+       if (! dbm::is_result($user)) {
                killme();
+       }
 
        $r = q("DELETE FROM `register` WHERE `hash` = '%s'",
                dbesc($register[0]['hash'])
@@ -70,7 +72,7 @@ function user_deny($hash) {
                dbesc($hash)
        );
 
-       if(! count($register))
+       if(! dbm::is_result($register))
                return false;
 
        $user = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
@@ -95,7 +97,7 @@ function user_deny($hash) {
 
 }
 
-function regmod_content(&$a) {
+function regmod_content(App &$a) {
 
        global $lang;
 
index 6920cbc187be335b4f15a076c595577345231494..4257667c4b1bf663325cbc2e4fdbe1950a2456a9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function removeme_post(&$a) {
+function removeme_post(App &$a) {
 
        if (! local_user()) {
                return;
@@ -32,7 +32,7 @@ function removeme_post(&$a) {
 
 }
 
-function removeme_content(&$a) {
+function removeme_content(App &$a) {
 
        if (! local_user()) {
                goaway(z_root());
index ba8a0717565bbf3844d5b79ab3376bba206cdaf9..07721220a087150f14a42bedb3d60235381e4c4e 100755 (executable)
@@ -3,7 +3,7 @@
 require_once('include/Scrape.php');
 require_once('include/follow.php');
 
-function repair_ostatus_content(&$a) {
+function repair_ostatus_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL);
index 6257adc1baba24745c2572723e887542ebbc62ec..13c84c3fcc47049e4367803bc12590d768488c80 100644 (file)
@@ -2,7 +2,7 @@
 
 
 
-function rsd_xml_content(&$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 ff5856a946861a7ae91ea2cae7e5f87004dac08f..6c3aea211447f4676229f349cd9352dca1be3cfb 100644 (file)
@@ -19,7 +19,7 @@ function salmon_return($val) {
 
 }
 
-function salmon_post(&$a) {
+function salmon_post(App &$a) {
 
        $xml = file_get_contents('php://input');
 
index 3de77a85c42d3b77de9f74c5b718e7277f20844b..22879f7f9e6aea569db9d61fe493ca1b7c864bf6 100644 (file)
@@ -43,7 +43,7 @@ function search_saved_searches() {
 }
 
 
-function search_init(&$a) {
+function search_init(App &$a) {
 
        $search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
 
@@ -81,13 +81,13 @@ function search_init(&$a) {
 
 
 
-function search_post(&$a) {
+function search_post(App &$a) {
        if(x($_POST,'search'))
                $a->data['search'] = $_POST['search'];
 }
 
 
-function search_content(&$a) {
+function search_content(App &$a) {
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                notice( t('Public access denied.') . EOL);
index 298b5025cde289e2c4a62e46905804190324f5e8..1fbd24325d14d23bed3b66e5483e7709d7520532 100644 (file)
@@ -16,7 +16,7 @@ function get_theme_config_file($theme){
        return null;
 }
 
-function settings_init(&$a) {
+function settings_init(App &$a) {
 
        if (! local_user()) {
                notice( t('Permission denied.') . EOL );
@@ -116,7 +116,7 @@ function settings_init(&$a) {
 }
 
 
-function settings_post(&$a) {
+function settings_post(App &$a) {
 
        if (! local_user()) {
                return;
@@ -654,7 +654,7 @@ function settings_post(&$a) {
 }
 
 
-function settings_content(&$a) {
+function settings_content(App &$a) {
 
        $o = '';
        nav_set_selected('settings');
index 0a34c6fc50699dd1923872f78d0aae8338be6820..f2e016708fef321a74937e3c8c9be93e5ba87401 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-function share_init(&$a) {
+function share_init(App &$a) {
 
        $post_id = (($a->argc > 1) ? intval($a->argv[1]) : 0);
        if((! $post_id) || (! local_user()))
index 573cf17c8a1a4f238c5cfdf77b96e51f729f613d..8e04d5d054497ef2b42cb3c742b52b9cdbaba82a 100644 (file)
@@ -6,7 +6,7 @@
 
 require_once("include/Smilies.php");
 
-function smilies_content(&$a) {
+function smilies_content(App &$a) {
        if ($a->argv[1]==="json"){
                $tmp = Smilies::get_list();
                $results = array();
index 84baa82ceacf4bbc4a0595022727b603e4c0634a..c23b07b8b595b22757b0fd1a0c7f31f4eed5ac3c 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function starred_init(&$a) {
+function starred_init(App &$a) {
 
        require_once("include/threads.php");
 
index 21a9a0521c63d395267bfbe60f0431936ab3e071..2f2adaafe7980c40e564bfc7e8499bae4a2e3af8 100644 (file)
@@ -5,7 +5,7 @@
 
 require_once("include/plugin.php");
 
-function statistics_json_init(&$a) {
+function statistics_json_init(App &$a) {
 
         if (!get_config("system", "nodeinfo")) {
                 http_status_exit(404);
index c154187a695dc4a11511c2824923a4e3b97771a6..c689f7f6cb57c50e089212e12cc784a8b3aba53a 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function subthread_content(&$a) {
+function subthread_content(App &$a) {
 
        if(! local_user() && ! remote_user()) {
                return;
@@ -71,8 +71,7 @@ function subthread_content(&$a) {
 
        if ((local_user()) && (local_user() == $owner_uid)) {
                $contact = $owner;
-       }
-       else {
+       } else {
                $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
                        intval($_SESSION['visitor_id']),
                        intval($owner_uid)
index 0004128a1a0a54c9d3180b1508ec0586e484ddaf..a6c4b6e5680219e549e0391048b0190c8d2b7634 100644 (file)
@@ -3,8 +3,7 @@
 require_once('include/socgraph.php');
 require_once('include/contact_widgets.php');
 
-
-function suggest_init(&$a) {
+function suggest_init(App &$a) {
        if (! local_user()) {
                return;
        }
@@ -16,8 +15,8 @@ function suggest_init(&$a) {
                        // so add any arguments as hidden inputs
                        $query = explode_querystring($a->query_string);
                        $inputs = array();
-                       foreach($query['args'] as $arg) {
-                               if(strpos($arg, 'confirm=') === false) {
+                       foreach ($query['args'] as $arg) {
+                               if (strpos($arg, 'confirm=') === false) {
                                        $arg_parts = explode('=', $arg);
                                        $inputs[] = array('name' => $arg_parts[0], 'value' => $arg_parts[1]);
                                }
@@ -50,7 +49,7 @@ function suggest_init(&$a) {
 
 
 
-function suggest_content(&$a) {
+function suggest_content(App &$a) {
 
        require_once("mod/proxy.php");
 
index e53bc5eaf19d9da64a9c2182370e817d7512420e..da5c4700f95a69a5adde0f87fd0f57c24ff3f9b1 100644 (file)
@@ -5,7 +5,7 @@ require_once('include/bbcode.php');
 require_once('include/items.php');
 
 
-function tagger_content(&$a) {
+function tagger_content(App &$a) {
 
        if(! local_user() && ! remote_user()) {
                return;
index 7a18d65d0660802a0d13fc5e4261d04623c41b3f..2a9a26e37bfd4ead658a459076ae082abfa8f4c9 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/bbcode.php');
 
-function tagrm_post(&$a) {
+function tagrm_post(App &$a) {
 
        if (! local_user()) {
                goaway(App::get_baseurl() . '/' . $_SESSION['photo_return']);
@@ -49,7 +49,7 @@ function tagrm_post(&$a) {
 
 
 
-function tagrm_content(&$a) {
+function tagrm_content(App &$a) {
 
        $o = '';
 
index 8ef2b9fc4ddaa5cd9d22b6bcc2f5ac3ef00d316a..89b73cd4484db62294a05c51724fee32f235f802 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function toggle_mobile_init(&$a) {
+function toggle_mobile_init(App &$a) {
 
        if (isset($_GET['off'])) {
                $_SESSION['show-mobile'] = false;
index 140f19a59bf42251b632fb9659dc33310b89f7ea..1ca046d22498860c323d3b1fc587ebf4c0bd0ff4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function uexport_init(&$a){
+function uexport_init(App &$a){
        if (! local_user()) {
                killme();
        }
@@ -9,7 +9,8 @@ function uexport_init(&$a){
        settings_init($a);
 }
 
-function uexport_content(&$a){
+/// @TODO Change space -> tab where wanted
+function uexport_content(App &$a){
 
     if ($a->argc > 1) {
         header("Content-type: application/json");
@@ -123,7 +124,7 @@ function uexport_account($a){
 /**
  * echoes account data and items as separated json, one per line
  */
-function uexport_all(&$a) {
+function uexport_all(App &$a) {
 
        uexport_account($a);
        echo "\n";
index 7ed5648d9e2d360de0cef3b85bb885ed9a903d66..15bc8322b97fdd3337c0293580e0f64cea59101a 100644 (file)
@@ -1,11 +1,12 @@
 <?php\r
 /**\r
  * View for user import\r
+ * @TODO This file has DOS line endings!\r
  */\r
 \r
 require_once("include/uimport.php");\r
 \r
-function uimport_post(&$a) {\r
+function uimport_post(App &$a) {\r
        switch($a->config['register_policy']) {\r
         case REGISTER_OPEN:\r
             $blocked = 0;\r
@@ -35,7 +36,7 @@ function uimport_post(&$a) {
     }\r
 }\r
 \r
-function uimport_content(&$a) {\r
+function uimport_content(App &$a) {\r
        \r
        if((! local_user()) && ($a->config['register_policy'] == REGISTER_CLOSED)) {\r
                notice("Permission denied." . EOL);\r
index d5df7ba3bf7e0545e355d2d2e8febcbbf7a78e91..179e9c61c4d991fdb457803a963caf027c98022e 100644 (file)
@@ -4,7 +4,7 @@
 
 require_once("mod/community.php");
 
-function update_community_content(&$a) {
+function update_community_content(App &$a) {
 
        header("Content-type: text/html");
        echo "<!DOCTYPE html><html><body>\r\n";
index bd2a52934ff477894b5f38815662ed15be973c88..230bbaa0b460d20cdabfb28e4ce5760f7a9b8019 100644 (file)
@@ -5,7 +5,7 @@
 require_once("mod/display.php");
 require_once("include/group.php");
 
-function update_display_content(&$a) {
+function update_display_content(App &$a) {
 
        $profile_uid = intval($_GET["p"]);
 
index 258d03e3227e80b35183ab2dcc92edfd961d8bbb..c6d33132cc7557d33eae48a3681c0f8ac713efce 100644 (file)
@@ -5,7 +5,7 @@
 require_once("mod/network.php");
 require_once("include/group.php");
 
-function update_network_content(&$a) {
+function update_network_content(App &$a) {
 
        $profile_uid = intval($_GET["p"]);
 
index ee9d1d71f56a7f25fabb46e8e7ad51d3977975c4..b21f698054b9fa3d92f9bdd2ba1ae2280ff5517e 100644 (file)
@@ -7,7 +7,7 @@
 
 require_once("mod/notes.php");
 
-function update_notes_content(&$a) {
+function update_notes_content(App &$a) {
 
        $profile_uid = intval($_GET["p"]);
 
index 1bc29d82cef3f3ad4c11d82f20fe61a08d895ef0..e16b0b5cccbe58126ca678c126aaefeba60ce7f7 100644 (file)
@@ -7,7 +7,7 @@
 
 require_once("mod/profile.php");
 
-function update_profile_content(&$a) {
+function update_profile_content(App &$a) {
 
        $profile_uid = intval($_GET["p"]);
 
index dbfc044ea0efdb89ee526b25749bfe3b2f13eace..433ce5fc63f82e2e150b7b7c9ce87325553ba50e 100644 (file)
@@ -6,7 +6,7 @@ require_once('include/security.php');
 require_once('include/redir.php');
 
 
-function videos_init(&$a) {
+function videos_init(App &$a) {
 
        if($a->argc > 1)
                auto_redir($a, $a->argv[1]);
@@ -102,7 +102,7 @@ function videos_init(&$a) {
 
 
 
-function videos_post(&$a) {
+function videos_post(App &$a) {
 
        $owner_uid = $a->data['user']['uid'];
 
@@ -113,7 +113,7 @@ function videos_post(&$a) {
        if (($a->argc == 2) && x($_POST,'delete') && x($_POST, 'id')) {
 
                // Check if we should do HTML-based delete confirmation
-               if(!x($_REQUEST,'confirm')) {
+               if (!x($_REQUEST,'confirm')) {
                        if (x($_REQUEST,'canceled')) {
                                goaway(App::get_baseurl() . '/videos/' . $a->data['user']['nickname']);
                        }
@@ -138,7 +138,6 @@ function videos_post(&$a) {
 
                $video_id = $_POST['id'];
 
-
                $r = q("SELECT `id`  FROM `attach` WHERE `uid` = %d AND `id` = '%s' LIMIT 1",
                        intval(local_user()),
                        dbesc($video_id)
@@ -154,7 +153,7 @@ function videos_post(&$a) {
                                intval(local_user())
                        );
                        //echo "<pre>"; var_dump($i); killme();
-                       if(count($i)) {
+                       if (dbm::is_result($i)) {
                                q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
                                        dbesc(datetime_convert()),
                                        dbesc(datetime_convert()),
@@ -167,8 +166,9 @@ function videos_post(&$a) {
                                $url = App::get_baseurl();
                                $drop_id = intval($i[0]['id']);
 
-                               if($i[0]['visible'])
+                               if ($i[0]['visible']) {
                                        proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
+                               }
                        }
                }
 
@@ -182,7 +182,7 @@ function videos_post(&$a) {
 
 
 
-function videos_content(&$a) {
+function videos_content(App &$a) {
 
        // URLs (most aren't currently implemented):
        // videos/name
@@ -408,4 +408,3 @@ function videos_content(&$a) {
        $o .= paginate($a);
        return $o;
 }
-
index ffb7154423e723fc46a9dbd0e83baf84db6c0013..9c72a46e9c7c2437ea41784c0e16696f819a6d91 100644 (file)
@@ -2,7 +2,7 @@
 require_once('include/Contact.php');
 require_once('include/contact_selectors.php');
 
-function viewcontacts_init(&$a) {
+function viewcontacts_init(App &$a) {
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
                return;
@@ -29,7 +29,7 @@ function viewcontacts_init(&$a) {
 }
 
 
-function viewcontacts_content(&$a) {
+function viewcontacts_content(App &$a) {
        require_once("mod/proxy.php");
 
        if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
index 94ed9b5dc247f602feaa6ad21a0df9af43bc73a6..8510bd539573ac72ebbd07b1636b53ad06bb61ce 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 
-function viewsrc_content(&$a) {
+function viewsrc_content(App &$a) {
 
        if (! local_user()) {
                notice( t('Access denied.') . EOL);
index 525d3509c17516f33efb52276eefba803db15d0b..18125685450c4760929ce37f90926f69f16a4a94 100644 (file)
@@ -3,7 +3,7 @@
 require_once('include/attach.php');
 require_once('include/datetime.php');
 
-function wall_attach_post(&$a) {
+function wall_attach_post(App &$a) {
 
        $r_json = (x($_GET,'response') && $_GET['response']=='json');
 
index afe25cbe8be9dfeb3fa0ac86c1023baa864f0e82..e0c702cdb0ca45abfcb9e1cdd96e405c058325a1 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/message.php');
 
-function wallmessage_post(&$a) {
+function wallmessage_post(App &$a) {
 
        $replyto = get_my_url();
        if(! $replyto) {
@@ -73,7 +73,7 @@ function wallmessage_post(&$a) {
 }
 
 
-function wallmessage_content(&$a) {
+function wallmessage_content(App &$a) {
 
        if(! get_my_url()) {
                notice( t('Permission denied.') . EOL);
index e1e5b367b9d2054edd878f4201bd4b47e6c3c553..f08451ba70446d380b75170c04272f721594d13e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once("include/Probe.php");
 
-function webfinger_content(&$a) {
+function webfinger_content(App &$a) {
 
        $o .= '<h3>Webfinger Diagnostic</h3>';
 
index e4641f5a35eb0eee2545f57bb88659dee65c5191..a56c7fbdffaa0503a971fd3891a6de7b76960e28 100644 (file)
@@ -2,7 +2,7 @@
 
 require_once('include/crypto.php');
 
-function xrd_init(&$a) {
+function xrd_init(App &$a) {
 
        $uri = urldecode(notags(trim($_GET['uri'])));
 
index 8340009a9b0b7899c2c632fac2bdbe34c1593754..d95af3419a0f8babb385e3505538b1898fe77c2f 100644 (file)
@@ -38,9 +38,9 @@ class Item extends BaseObject {
                $this->set_template('wall');
                $this->toplevel = ($this->get_id() == $this->get_data_value('parent'));
 
-               if(is_array($_SESSION['remote'])) {
-                       foreach($_SESSION['remote'] as $visitor) {
-                               if($visitor['cid'] == $this->get_data_value('contact-id')) {
+               if (is_array($_SESSION['remote'])) {
+                       foreach ($_SESSION['remote'] as $visitor) {
+                               if ($visitor['cid'] == $this->get_data_value('contact-id')) {
                                        $this->visiting = true;
                                        break;
                                }
index 749a377fc66d3e650b04ca0c8506e127a42d6cfd..48c9c8709918fc7ab6d0915d62e5bb499f67c453 100644 (file)
@@ -3,9 +3,7 @@
  * Theme settings
  */
 
-
-
-function theme_content(&$a){
+function theme_content(App &$a){
        if (!local_user()) {
                return;
        }
@@ -16,8 +14,7 @@ function theme_content(&$a){
        return clean_form($a, $colorset, $user);
 }
 
-function theme_post(&$a){
-
+function theme_post(App &$a){
        if (! local_user()) {
                return;
        }
@@ -27,15 +24,14 @@ function theme_post(&$a){
        }
 }
 
-
-function theme_admin(&$a){
+function theme_admin(App &$a){
        $colorset = get_config( 'duepuntozero', 'colorset');
        $user = false;
 
        return clean_form($a, $colorset, $user);
 }
 
-function theme_admin_post(&$a){
+function theme_admin_post(App &$a){
        if (isset($_POST['duepuntozero-settings-submit'])){
                set_config('duepuntozero', 'colorset', $_POST['duepuntozero_colorset']);
        }
@@ -44,13 +40,13 @@ function theme_admin_post(&$a){
 /// @TODO $a is no longer used
 function clean_form(&$a, &$colorset, $user){
        $colorset = array(
-               'default'=>t('default'), 
-               'greenzero'=>t('greenzero'),
-               'purplezero'=>t('purplezero'),
-               'easterbunny'=>t('easterbunny'),
-               'darkzero'=>t('darkzero'),
-               'comix'=>t('comix'),
-               'slackr'=>t('slackr'),
+               'default'     =>t('default'), 
+               'greenzero'   =>t('greenzero'),
+               'purplezero'  =>t('purplezero'),
+               'easterbunny' =>t('easterbunny'),
+               'darkzero'    =>t('darkzero'),
+               'comix'       =>t('comix'),
+               'slackr'      =>t('slackr'),
        );
 
        if ($user) {
@@ -64,7 +60,7 @@ function clean_form(&$a, &$colorset, $user){
        $o .= replace_macros($t, array(
                '$submit'   => t('Submit'),
                '$baseurl'  => App::get_baseurl(),
-               '$title'=> t("Theme settings"),
+               '$title'    => t("Theme settings"),
                '$colorset' => array('duepuntozero_colorset', t('Variations'), $color, '', $colorset),
        ));
 
index 50d57f91e5759041f463284537ddcfcc1495ad9d..bf1d031def9367c1d5128315313fab16e1ab1c66 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-function duepuntozero_init(&$a) {
+function duepuntozero_init(App &$a) {
 
 set_template_engine($a, 'smarty3');
 
index edd16bd71fa30ce5a695b4f27dc9eecf312e3460..000ef26092fa43330d1dcdda24489ade8980f3f6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 require_once('view/theme/frio/php/Image.php');
 
-function theme_content(&$a) {
+function theme_content(App &$a) {
        if (!local_user()) {
                return;
        }
@@ -19,7 +19,7 @@ function theme_content(&$a) {
        return frio_form($a, $arr);
 }
 
-function theme_post(&$a) {
+function theme_post(App &$a) {
        if (!local_user()) {
                return;
        }
index 827874d7e1628ac60247ed14a3a30f8b122210c1..0e221f5337db55a38c6f9623128824b332a9e13d 100644 (file)
@@ -13,7 +13,7 @@
  * 
  * @todo Check if this is really needed.
  */
-function load_page(&$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"))) {
index 4a320e1f87a5f43d63b5a8aebd555b7aa1aaa46e..f9cbf79a6ab7939f2ceb31574d391baec99b3f70 100644 (file)
@@ -11,7 +11,7 @@ $frio = "view/theme/frio";
 
 global $frio;
 
-function frio_init(&$a) {
+function frio_init(App &$a) {
 
        // disable the events module link in the profile tab
        $a->theme_events_in_profile = false;
index ceb28c2d6627abd3883c6d9759f9dbed5a83851e..4ca592f4c880a5c47c1acb432133401eeaa1eaa4 100644 (file)
@@ -9,7 +9,7 @@
  * Maintainer: Zach P <techcity@f.shmuz.in>
  */
 
-function frost_mobile_init(&$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(&$a) {
        set_template_engine($a, 'smarty3');
 }
 
-function frost_mobile_content_loaded(&$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 b93123b3dd6a9a02405b11fe78d034a9856e663d..7746109e56df657c50fec7747838ea8184f3cec5 100644 (file)
@@ -9,14 +9,14 @@
  * Maintainer: Zach P <techcity@f.shmuz.in>
  */
 
-function frost_init(&$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(&$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
index 9a08adbaf9f99bf790c8388e2c3dd4ccf7843934..6c80afdc22d0a2be1c3468a84b13a4c31b298cbf 100644 (file)
@@ -3,9 +3,7 @@
  * Theme settings
  */
 
-
-
-function theme_content(&$a){
+function theme_content(App &$a){
        if (!local_user()) {
                return;
        }
@@ -18,7 +16,7 @@ function theme_content(&$a){
        return quattro_form($a,$align, $color, $tfs, $pfs);
 }
 
-function theme_post(&$a){
+function theme_post(App &$a){
        if (! local_user()) {
                return;
        }
@@ -31,45 +29,48 @@ function theme_post(&$a){
        }
 }
 
-
-function theme_admin(&$a){
+function theme_admin(App &$a){
        $align = get_config('quattro', 'align' );
        $color = get_config('quattro', 'color' );
-    $tfs = get_config("quattro","tfs");
-    $pfs = get_config("quattro","pfs");    
+       $tfs = get_config("quattro","tfs");
+       $pfs = get_config("quattro","pfs");
 
        return quattro_form($a,$align, $color, $tfs, $pfs);
 }
 
-function theme_admin_post(&$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']);
-        set_config('quattro', 'tfs', $_POST['quattro_tfs']);
+               set_config('quattro', 'tfs', $_POST['quattro_tfs']);
                set_config('quattro', 'pfs', $_POST['quattro_pfs']);
        }
 }
 
 /// @TODO $a is no longer used here
-function quattro_form(&$a, $align, $color, $tfs, $pfs){
+function quattro_form(App &$a, $align, $color, $tfs, $pfs){
        $colors = array(
-               "dark"=>"Quattro", 
-               "lilac"=>"Lilac", 
-               "green"=>"Green"
+               "dark"  => "Quattro",
+               "lilac" => "Lilac",
+               "green" => "Green",
        );
-    
-    if ($tfs===false) $tfs="20";
-    if ($pfs===false) $pfs="12";
-    
+
+       if ($tfs === false) {
+               $tfs = "20";
+       }
+       if ($pfs === false) {
+               $pfs = "12";
+       }
+
        $t = get_markup_template("theme_settings.tpl" );
        $o .= replace_macros($t, array(
-               '$submit' => t('Submit'),
+               '$submit'  => t('Submit'),
                '$baseurl' => App::get_baseurl(),
-               '$title' => t("Theme settings"),
-               '$align' => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
-               '$color' => array('quattro_color', t('Color scheme'), $color, '', $colors),
-        '$pfs' => array('quattro_pfs', t('Posts font size'), $pfs),
-        '$tfs' => array('quattro_tfs',t('Textareas font size'), $tfs),
+               '$title'   => t("Theme settings"),
+               '$align'   => array('quattro_align', t('Alignment'), $align, '', array('left'=>t('Left'), 'center'=>t('Center'))),
+               '$color'   => array('quattro_color', t('Color scheme'), $color, '', $colors),
+               '$pfs'     => array('quattro_pfs', t('Posts font size'), $pfs),
+               '$tfs'     => array('quattro_tfs',t('Textareas font size'), $tfs),
        ));
        return $o;
 }
index f316323fd31cf60a6ecf9cb0e67f510873998a71..ae8f4f906594b0d73f5dcad03dd78d7af708907e 100644 (file)
@@ -7,7 +7,7 @@
  * Maintainer: Tobias <https://diekershoff.homeunix.net/friendica/profile/tobias>
  */
 
-function quattro_init(&$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 189110a952d21813a26d7bbadf279d91501922da..32c48fffa4bf3b0d19b554861fbd31899d0ec790 100644 (file)
@@ -10,7 +10,7 @@
  * Screenshot: <a href="screenshot.png">Screenshot</a>
  */
 
-function smoothly_init(&$a) {
+function smoothly_init(App &$a) {
        set_template_engine($a, 'smarty3');
 
        $cssFile = null;
index 2989f6c5cfb1a8e229e6114db42ad8f4a5a97038..5326498908d931bf7130db6d3ab1e6e638d1182f 100644 (file)
@@ -5,7 +5,7 @@
 
 
 
-function theme_content(&$a){
+function theme_content(App &$a){
        if (!local_user()) {
                return;
        }
@@ -35,7 +35,7 @@ function theme_content(&$a){
                        $show_services, $show_friends, $show_lastusers);
 }
 
-function theme_post(&$a){
+function theme_post(App &$a){
        if (! local_user()) {
                return;
        }
@@ -52,7 +52,7 @@ function theme_post(&$a){
 }
 
 
-function theme_admin(&$a){
+function theme_admin(App &$a){
 
        if (!function_exists('get_vier_config'))
                return;
@@ -81,7 +81,7 @@ function theme_admin(&$a){
        return $o;
 }
 
-function theme_admin_post(&$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']);
index b909a26025e64d18eba10a074e4277144c345518..8be91220afcc815f0d468f860e7df5afe5464350 100644 (file)
@@ -13,7 +13,7 @@ require_once("include/plugin.php");
 require_once("include/socgraph.php");
 require_once("mod/proxy.php");
 
-function vier_init(&$a) {
+function vier_init(App &$a) {
 
        $a->theme_events_in_profile = false;