From b202e02fbf09859c06ed21cc3b6bec1530ccf1f1 Mon Sep 17 00:00:00 2001 From: fabrixxm Date: Sun, 7 Feb 2016 15:11:34 +0100 Subject: [PATCH] Revert "Updated modules to allow for partial overrides without errors" This reverts commit db949bb802448184bfe5164d8d3dd86ddf51b187. --- mod/_well_known.php | 4 -- mod/acctlink.php | 3 +- mod/acl.php | 4 +- mod/admin.php | 78 +++++++++++---------------------------- mod/allfriends.php | 2 - mod/amcd.php | 5 +-- mod/api.php | 11 +++--- mod/apps.php | 40 ++++++++++---------- mod/attach.php | 3 +- mod/babel.php | 46 +++++++++++------------ mod/bookmarklet.php | 5 +-- mod/cb.php | 11 +----- mod/common.php | 2 - mod/community.php | 13 +++---- mod/contactgroup.php | 4 +- mod/contacts.php | 38 ++++--------------- mod/content.php | 48 ++++++++++++------------ mod/credits.php | 2 - mod/crepair.php | 10 ++--- mod/delegate.php | 10 ++--- mod/dfrn_confirm.php | 3 +- mod/dfrn_notify.php | 6 +-- mod/dfrn_poll.php | 13 +++---- mod/directory.php | 19 +++++----- mod/dirfind.php | 6 +-- mod/display.php | 9 ++--- mod/editpost.php | 5 ++- mod/events.php | 6 +-- mod/fbrowser.php | 3 +- mod/filer.php | 5 +-- mod/filerm.php | 2 - mod/follow.php | 4 -- mod/friendica.php | 11 +++--- mod/fsuggest.php | 19 +++++----- mod/group.php | 11 ++---- mod/hcard.php | 10 ++--- mod/help.php | 3 +- mod/hostxrd.php | 3 +- mod/ignored.php | 3 +- mod/install.php | 55 +++++++++------------------ mod/invite.php | 13 +++---- mod/item.php | 13 ++----- mod/like.php | 7 ++-- mod/localtime.php | 11 +++--- mod/lockview.php | 20 +++++----- mod/login.php | 4 +- mod/lostpass.php | 7 ++-- mod/maintenance.php | 3 +- mod/manage.php | 8 ++-- mod/match.php | 2 - mod/message.php | 13 ++----- mod/modexp.php | 4 +- mod/mood.php | 10 ++--- mod/msearch.php | 9 ++--- mod/navigation.php | 3 +- mod/network.php | 17 ++------- mod/newmember.php | 10 ++--- mod/nodeinfo.php | 11 ++---- mod/nogroup.php | 6 +-- mod/noscrape.php | 3 +- mod/notes.php | 20 +++++----- mod/notice.php | 9 ++--- mod/notifications.php | 6 +-- mod/notify.php | 8 ++-- mod/oembed.php | 4 +- mod/oexchange.php | 17 +++++---- mod/openid.php | 10 ++--- mod/opensearch.php | 16 ++++---- mod/ostatus_subscribe.php | 2 - mod/p.php | 4 +- mod/parse_url.php | 18 ++------- mod/photo.php | 2 - mod/photos.php | 15 ++++---- mod/ping.php | 4 -- mod/poco.php | 3 +- mod/poke.php | 12 +++--- mod/post.php | 7 ++-- mod/pretheme.php | 4 +- mod/probe.php | 4 +- mod/profile.php | 7 ++-- mod/profile_photo.php | 26 ++++++------- mod/profiles.php | 14 ++----- mod/profperm.php | 12 +++--- mod/proxy.php | 12 ------ mod/pubsub.php | 20 +++++----- mod/pubsubhubbub.php | 5 +-- mod/qsearch.php | 3 +- mod/randprof.php | 3 +- mod/receive.php | 4 +- mod/redir.php | 6 +-- mod/regmod.php | 9 ++--- mod/removeme.php | 6 +-- mod/repair_ostatus.php | 2 - mod/rsd_xml.php | 6 +-- mod/salmon.php | 7 +--- mod/search.php | 14 +++---- mod/session.php | 3 +- mod/settings.php | 16 ++++---- mod/share.php | 9 +---- mod/smilies.php | 6 +-- mod/starred.php | 3 +- mod/statistics_json.php | 2 - mod/subthread.php | 12 +++--- mod/suggest.php | 9 ++--- mod/tagger.php | 8 ++-- mod/tagrm.php | 9 ++--- mod/toggle_mobile.php | 3 +- mod/uexport.php | 30 ++++++--------- mod/uimport.php | 12 ++---- mod/update_community.php | 5 +-- mod/update_display.php | 3 +- mod/update_network.php | 3 +- mod/update_notes.php | 9 ++--- mod/update_profile.php | 9 ++--- mod/videos.php | 12 +++--- mod/view.php | 10 ++--- mod/viewcontacts.php | 5 +-- mod/viewsrc.php | 6 +-- mod/wall_attach.php | 2 - mod/wall_upload.php | 2 - mod/wallmessage.php | 12 +++--- mod/webfinger.php | 6 +-- mod/xrd.php | 3 +- 123 files changed, 471 insertions(+), 768 deletions(-) diff --git a/mod/_well_known.php b/mod/_well_known.php index 6c33136f95..33070a1ecd 100644 --- a/mod/_well_known.php +++ b/mod/_well_known.php @@ -2,7 +2,6 @@ require_once("mod/hostxrd.php"); require_once("mod/nodeinfo.php"); -if(! function_exists('_well_known_init')) { function _well_known_init(&$a){ if ($a->argc > 1) { switch($a->argv[1]) { @@ -20,9 +19,7 @@ function _well_known_init(&$a){ http_status_exit(404); killme(); } -} -if(! function_exists('wk_social_relay')) { function wk_social_relay(&$a) { define('SR_SCOPE_ALL', 'all'); @@ -67,4 +64,3 @@ function wk_social_relay(&$a) { echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES); exit; } -} diff --git a/mod/acctlink.php b/mod/acctlink.php index a551e3dbd6..a2365803ac 100644 --- a/mod/acctlink.php +++ b/mod/acctlink.php @@ -2,8 +2,8 @@ require_once('include/Scrape.php'); -if(! function_exists('acctlink_init')) { function acctlink_init(&$a) { + if(x($_GET,'addr')) { $addr = trim($_GET['addr']); $res = probe_url($addr); @@ -14,4 +14,3 @@ function acctlink_init(&$a) { } } } -} diff --git a/mod/acl.php b/mod/acl.php index 5666ccabb8..f5e04b96a7 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -3,8 +3,8 @@ require_once("include/acl_selectors.php"); -if(! function_exists('acl_init')) { function acl_init(&$a){ acl_lookup($a); } -} + + diff --git a/mod/admin.php b/mod/admin.php index ff17c0b8c4..7f9000807b 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -2,7 +2,7 @@ /** * @file mod/admin.php - * + * * @brief Friendica admin */ @@ -23,7 +23,6 @@ require_once("include/text.php"); * @param App $a * */ -if(! function_exists('admin_post')) { function admin_post(&$a){ @@ -111,7 +110,6 @@ function admin_post(&$a){ goaway($a->get_baseurl(true) . '/admin' ); return; // NOTREACHED } -} /** * @brief Generates content of the admin panel pages @@ -130,7 +128,6 @@ function admin_post(&$a){ * @param App $a * @return string */ -if(! function_exists('admin_content')) { function admin_content(&$a) { if(!is_site_admin()) { @@ -248,7 +245,6 @@ function admin_content(&$a) { return $o; } } -} /** * @brief Subpage with some stats about "the federation" network @@ -264,7 +260,6 @@ function admin_content(&$a) { * @param App $a * @return string */ -if(! function_exists('admin_page_federation')) { function admin_page_federation(&$a) { // get counts on active friendica, diaspora, redmatrix, hubzilla, gnu // social and statusnet nodes this node is knowing @@ -289,7 +284,7 @@ function admin_page_federation(&$a) { // what versions for that platform do we know at all? // again only the active nodes $v = q('SELECT count(*) AS total, version FROM gserver - WHERE last_contact > last_failure AND platform LIKE "%s" + WHERE last_contact > last_failure AND platform LIKE "%s" GROUP BY version ORDER BY version;', $p); @@ -306,12 +301,12 @@ function admin_page_federation(&$a) { $newVC = $vv['total']; $newVV = $vv['version']; $posDash = strpos($newVV, '-'); - if($posDash) + if($posDash) $newVV = substr($newVV, 0, $posDash); if(isset($newV[$newVV])) - $newV[$newVV] += $newVC; + $newV[$newVV] += $newVC; else - $newV[$newVV] = $newVC; + $newV[$newVV] = $newVC; } foreach ($newV as $key => $value) { array_push($newVv, array('total'=>$value, 'version'=>$key)); @@ -366,7 +361,6 @@ function admin_page_federation(&$a) { '$baseurl' => $a->get_baseurl(), )); } -} /** * @brief Admin Inspect Queue Page @@ -381,7 +375,6 @@ function admin_page_federation(&$a) { * @param App $a * @return string */ -if(! function_exists('admin_page_queue')) { function admin_page_queue(&$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 where c.id=q.cid order by q.cid, q.created;"); @@ -401,7 +394,6 @@ function admin_page_queue(&$a) { '$entries' => $r, )); } -} /** * @brief Admin Summary Page @@ -414,7 +406,6 @@ function admin_page_queue(&$a) { * @param App $a * @return string */ -if(! function_exists('admin_page_summary')) { function admin_page_summary(&$a) { $r = q("SELECT `page-flags`, COUNT(uid) as `count` FROM `user` GROUP BY `page-flags`"); $accounts = array( @@ -461,14 +452,12 @@ function admin_page_summary(&$a) { '$plugins' => array( t('Active plugins'), $a->plugins ) )); } -} /** * @brief Process send data from Admin Site Page - * + * * @param App $a */ -if(! function_exists('admin_page_site_post')) { function admin_page_site_post(&$a) { if(!x($_POST,"page_site")) { return; @@ -781,7 +770,6 @@ function admin_page_site_post(&$a) { return; // NOTREACHED } -} /** * @brief Generate Admin Site subpage @@ -791,7 +779,6 @@ function admin_page_site_post(&$a) { * @param App $a * @return string */ -if(! function_exists('admin_page_site')) { function admin_page_site(&$a) { /* Installed langs */ @@ -996,7 +983,7 @@ function admin_page_site(&$a) { '$form_security_token' => get_form_security_token("admin_site") )); -} + } /** @@ -1011,7 +998,6 @@ function admin_page_site(&$a) { * @param App $a * @return string **/ -if(! function_exists('admin_page_dbsync')) { function admin_page_dbsync(&$a) { $o = ''; @@ -1087,15 +1073,14 @@ function admin_page_dbsync(&$a) { } return $o; -} + } /** * @brief Process data send by Users admin page - * + * * @param App $a */ -if(! function_exists('admin_page_users_post')) { function admin_page_users_post(&$a){ $pending = ( x($_POST, 'pending') ? $_POST['pending'] : array() ); $users = ( x($_POST, 'user') ? $_POST['user'] : array() ); @@ -1186,7 +1171,6 @@ function admin_page_users_post(&$a){ goaway($a->get_baseurl(true) . '/admin/users' ); return; // NOTREACHED } -} /** * @brief Admin panel subpage for User management @@ -1200,7 +1184,6 @@ function admin_page_users_post(&$a){ * @param App $a * @return string */ -if(! function_exists('admin_page_users')) { function admin_page_users(&$a){ if($a->argc>2) { $uid = $a->argv[3]; @@ -1353,7 +1336,7 @@ function admin_page_users(&$a){ $o .= paginate($a); return $o; } -} + /** * @brief Plugins admin page @@ -1371,7 +1354,6 @@ function admin_page_users(&$a){ * @param App $a * @return string */ -if(! function_exists('admin_page_plugins')) { function admin_page_plugins(&$a){ /* @@ -1497,19 +1479,17 @@ function admin_page_plugins(&$a){ '$baseurl' => $a->get_baseurl(true), '$function' => 'plugins', '$plugins' => $plugins, - '$pcount' => count($plugins), + '$pcount' => count($plugins), '$noplugshint' => sprintf( t('There are currently no plugins available on your node. You can find the official plugin repository at %1$s and might find other interesting plugins in the open plugin registry at %2$s'), 'https://github.com/friendica/friendica-addons', 'http://addons.friendi.ca'), '$form_security_token' => get_form_security_token("admin_themes"), )); } -} /** * @param array $themes * @param string $th * @param int $result */ -if(! function_exists('toggle_theme')) { function toggle_theme(&$themes,$th,&$result) { for($x = 0; $x < count($themes); $x ++) { if($themes[$x]['name'] === $th) { @@ -1524,14 +1504,12 @@ function toggle_theme(&$themes,$th,&$result) { } } } -} /** * @param array $themes * @param string $th * @return int */ -if(! function_exists('theme_status')) { function theme_status($themes,$th) { for($x = 0; $x < count($themes); $x ++) { if($themes[$x]['name'] === $th) { @@ -1545,13 +1523,12 @@ function theme_status($themes,$th) { } return 0; } -} + /** * @param array $themes * @return string */ -if(! function_exists('rebuild_theme_table')) { function rebuild_theme_table($themes) { $o = ''; if(count($themes)) { @@ -1565,7 +1542,7 @@ function rebuild_theme_table($themes) { } return $o; } -} + /** * @brief Themes admin page @@ -1583,7 +1560,6 @@ function rebuild_theme_table($themes) { * @param App $a * @return string */ -if(! function_exists('admin_page_themes')) { function admin_page_themes(&$a){ $allowed_themes_str = get_config('system','allowed_themes'); @@ -1758,14 +1734,13 @@ function admin_page_themes(&$a){ '$form_security_token' => get_form_security_token("admin_themes"), )); } -} + /** * @brief Prosesses data send by Logs admin page - * + * * @param App $a */ -if(! function_exists('admin_page_logs_post')) { function admin_page_logs_post(&$a) { if(x($_POST,"page_logs")) { check_form_security_token_redirectOnErr('/admin/logs', 'admin_logs'); @@ -1783,7 +1758,6 @@ function admin_page_logs_post(&$a) { goaway($a->get_baseurl(true) . '/admin/logs' ); return; // NOTREACHED } -} /** * @brief Generates admin panel subpage for configuration of the logs @@ -1801,7 +1775,6 @@ function admin_page_logs_post(&$a) { * @param App $a * @return string */ -if(! function_exists('admin_page_logs')) { function admin_page_logs(&$a){ $log_choices = array( @@ -1833,7 +1806,6 @@ function admin_page_logs(&$a){ '$phplogcode' => "error_reporting(E_ERROR | E_WARNING | E_PARSE );\nini_set('error_log','php.out');\nini_set('log_errors','1');\nini_set('display_errors', '1');", )); } -} /** * @brief Generates admin panel subpage to view the Friendica log @@ -1853,7 +1825,6 @@ function admin_page_logs(&$a){ * @param App $a * @return string */ -if(! function_exists('admin_page_viewlogs')) { function admin_page_viewlogs(&$a){ $t = get_markup_template("admin_viewlogs.tpl"); $f = get_config('system','logfile'); @@ -1890,14 +1861,12 @@ function admin_page_viewlogs(&$a){ '$logname' => get_config('system','logfile') )); } -} /** * @brief Prosesses data send by the features admin page - * + * * @param App $a */ -if(! function_exists('admin_page_features_post')) { function admin_page_features_post(&$a) { check_form_security_token_redirectOnErr('/admin/features', 'admin_manage_features'); @@ -1929,25 +1898,23 @@ function admin_page_features_post(&$a) { goaway($a->get_baseurl(true) . '/admin/features' ); return; // NOTREACHED } -} /** * @brief Subpage for global additional feature management - * + * * This functin generates the subpage 'Manage Additional Features' * for the admin panel. At this page the admin can set preferences - * for the user settings of the 'additional features'. If needed this + * for the user settings of the 'additional features'. If needed this * preferences can be locked through the admin. - * + * * The returned string contains the HTML code of the subpage 'Manage * Additional Features' - * + * * @param App $a * @return string */ -if(! function_exists('admin_page_features')) { function admin_page_features(&$a) { - + if((argc() > 1) && (argv(1) === 'features')) { $arr = array(); $features = get_features(false); @@ -1966,7 +1933,7 @@ function admin_page_features(&$a) { ); } } - + $tpl = get_markup_template("admin_settings_features.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("admin_manage_features"), @@ -1978,4 +1945,3 @@ function admin_page_features(&$a) { return $o; } } -} diff --git a/mod/allfriends.php b/mod/allfriends.php index 8843265a99..356a389b83 100644 --- a/mod/allfriends.php +++ b/mod/allfriends.php @@ -5,7 +5,6 @@ require_once('include/Contact.php'); require_once('include/contact_selectors.php'); require_once('mod/contacts.php'); -if(! function_exists('allfriends_content')) { function allfriends_content(&$a) { $o = ''; @@ -98,4 +97,3 @@ function allfriends_content(&$a) { return $o; } -} diff --git a/mod/amcd.php b/mod/amcd.php index 141a804298..a2a1327e6d 100644 --- a/mod/amcd.php +++ b/mod/amcd.php @@ -1,5 +1,5 @@ get_parameters(); $token = $params['oauth_token']; @@ -17,10 +19,9 @@ function oauth_get_client($request){ return $r[0]; } -} -if(! function_exists('api_post')) { function api_post(&$a) { + if(! local_user()) { notice( t('Permission denied.') . EOL); return; @@ -30,10 +31,9 @@ function api_post(&$a) { notice( t('Permission denied.') . EOL); return; } -} + } -if(! function_exists('api_content')) { function api_content(&$a) { if ($a->cmd=='api/oauth/authorize'){ /* @@ -114,4 +114,3 @@ function api_content(&$a) { echo api_call($a); killme(); } -} diff --git a/mod/apps.php b/mod/apps.php index e807feae74..a821ef5d5b 100644 --- a/mod/apps.php +++ b/mod/apps.php @@ -1,23 +1,25 @@ apps)==0) - notice( t('No installed applications.') . EOL); - - $tpl = get_markup_template("apps.tpl"); - return replace_macros($tpl, array( - '$title' => $title, - '$apps' => $a->apps, - )); + $privateaddons = get_config('config','private_addons'); + if ($privateaddons === "1") { + if((! (local_user()))) { + info( t("You must be logged in to use addons. ")); + return;}; } + + $title = t('Applications'); + + if(count($a->apps)==0) + notice( t('No installed applications.') . EOL); + + + $tpl = get_markup_template("apps.tpl"); + return replace_macros($tpl, array( + '$title' => $title, + '$apps' => $a->apps, + )); + + + } diff --git a/mod/attach.php b/mod/attach.php index 849faa26ec..03f850f0d1 100644 --- a/mod/attach.php +++ b/mod/attach.php @@ -1,7 +1,7 @@ argc != 2) { @@ -47,4 +47,3 @@ function attach_init(&$a) { killme(); // NOTREACHED } -} diff --git a/mod/babel.php b/mod/babel.php index 56455bdb21..d31e090c55 100644 --- a/mod/babel.php +++ b/mod/babel.php @@ -9,56 +9,55 @@ function visible_lf($s) { return str_replace("\n",'
', $s); } -if(! function_exists('babel_content')) { function babel_content(&$a) { $o .= '

Babel Diagnostic

'; $o .= '
'; $o .= t('Source (bbcode) text:') . EOL . '' . EOL; - $o .= '
'; + $o .= ''; $o .= '

'; $o .= '
'; $o .= t('Source (Diaspora) text to convert to BBcode:') . EOL . '' . EOL; - $o .= '
'; + $o .= ''; $o .= '

'; if(x($_REQUEST,'text')) { $text = trim($_REQUEST['text']); - $o .= "

" . t("Source input: ") . "

" . EOL. EOL; - $o .= visible_lf($text) . EOL. EOL; + $o .= "

" . t("Source input: ") . "

" . EOL. EOL; + $o .= visible_lf($text) . EOL. EOL; $html = bbcode($text); - $o .= "

" . t("bb2html (raw HTML): ") . "

" . EOL. EOL; - $o .= htmlspecialchars($html). EOL. EOL; + $o .= "

" . t("bb2html (raw HTML): ") . "

" . EOL. EOL; + $o .= htmlspecialchars($html). EOL. EOL; //$html = bbcode($text); - $o .= "

" . t("bb2html: ") . "

" . EOL. EOL; - $o .= $html. EOL. EOL; + $o .= "

" . t("bb2html: ") . "

" . EOL. EOL; + $o .= $html. EOL. EOL; $bbcode = html2bbcode($html); - $o .= "

" . t("bb2html2bb: ") . "

" . EOL. EOL; - $o .= visible_lf($bbcode) . EOL. EOL; + $o .= "

" . t("bb2html2bb: ") . "

" . EOL. EOL; + $o .= visible_lf($bbcode) . EOL. EOL; $diaspora = bb2diaspora($text); - $o .= "

" . t("bb2md: ") . "

" . EOL. EOL; - $o .= visible_lf($diaspora) . EOL. EOL; + $o .= "

" . t("bb2md: ") . "

" . EOL. EOL; + $o .= visible_lf($diaspora) . EOL. EOL; $html = Markdown($diaspora); - $o .= "

" . t("bb2md2html: ") . "

" . EOL. EOL; - $o .= $html. EOL. EOL; + $o .= "

" . t("bb2md2html: ") . "

" . EOL. EOL; + $o .= $html. EOL. EOL; $bbcode = diaspora2bb($diaspora); - $o .= "

" . t("bb2dia2bb: ") . "

" . EOL. EOL; - $o .= visible_lf($bbcode) . EOL. EOL; + $o .= "

" . t("bb2dia2bb: ") . "

" . EOL. EOL; + $o .= visible_lf($bbcode) . EOL. EOL; $bbcode = html2bbcode($html); - $o .= "

" . t("bb2md2html2bb: ") . "

" . EOL. EOL; - $o .= visible_lf($bbcode) . EOL. EOL; + $o .= "

" . t("bb2md2html2bb: ") . "

" . EOL. EOL; + $o .= visible_lf($bbcode) . EOL. EOL; @@ -67,15 +66,14 @@ function babel_content(&$a) { if(x($_REQUEST,'d2bbtext')) { $d2bbtext = trim($_REQUEST['d2bbtext']); - $o .= "

" . t("Source input (Diaspora format): ") . "

" . EOL. EOL; - $o .= visible_lf($d2bbtext) . EOL. EOL; + $o .= "

" . t("Source input (Diaspora format): ") . "

" . EOL. EOL; + $o .= visible_lf($d2bbtext) . EOL. EOL; $bb = diaspora2bb($d2bbtext); - $o .= "

" . t("diaspora2bb: ") . "

" . EOL. EOL; - $o .= visible_lf($bb) . EOL. EOL; + $o .= "

" . t("diaspora2bb: ") . "

" . EOL. EOL; + $o .= visible_lf($bb) . EOL. EOL; } return $o; } -} diff --git a/mod/bookmarklet.php b/mod/bookmarklet.php index 4db6bf401e..be8645c1fd 100644 --- a/mod/bookmarklet.php +++ b/mod/bookmarklet.php @@ -1,14 +1,12 @@ '.t('Login').''; @@ -46,4 +44,3 @@ function bookmarklet_content(&$a) { return $o; } -} diff --git a/mod/cb.php b/mod/cb.php index 04d01302c1..6375d23984 100644 --- a/mod/cb.php +++ b/mod/cb.php @@ -4,28 +4,21 @@ * General purpose landing page for plugins/addons */ -if(! function_exists('cb_init')) { + function cb_init(&$a) { call_hooks('cb_init'); } -} -if(! function_exists('cb_post')) { function cb_post(&$a) { call_hooks('cb_post', $_POST); } -} -if(! function_exists('cb_afterpost')) { function cb_afterpost(&$a) { call_hooks('cb_afterpost'); } -} -if(! function_exists('cb_content')) { function cb_content(&$a) { $o = ''; call_hooks('cb_content', $o); return $o; -} -} +} \ No newline at end of file diff --git a/mod/common.php b/mod/common.php index 4cdbe9641b..c9409b3ef1 100644 --- a/mod/common.php +++ b/mod/common.php @@ -5,7 +5,6 @@ require_once('include/Contact.php'); require_once('include/contact_selectors.php'); require_once('mod/contacts.php'); -if(! function_exists('common_content')) { function common_content(&$a) { $o = ''; @@ -145,4 +144,3 @@ function common_content(&$a) { return $o; } -} diff --git a/mod/community.php b/mod/community.php index c64c6216b1..b6d72a3555 100644 --- a/mod/community.php +++ b/mod/community.php @@ -1,14 +1,15 @@ data['contact']['network'] != "") AND ($a->data['contact']['network'] != NETWORK_DFRN)) { $networkname = format_network_name($a->data['contact']['network'],$a->data['contact']['url']); - } else + } else $networkname = ''; $vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array( @@ -89,10 +88,9 @@ function contacts_init(&$a) { '$base' => $base )); -} + } -if(! function_exists('contacts_batch_actions')) { function contacts_batch_actions(&$a){ $contacts_id = $_POST['contact_batch']; if (!is_array($contacts_id)) return; @@ -134,10 +132,10 @@ function contacts_batch_actions(&$a){ goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); else goaway($a->get_baseurl(true) . '/contacts'); -} + } -if(! function_exists('contacts_post')) { + function contacts_post(&$a) { if(! local_user()) @@ -217,11 +215,10 @@ function contacts_post(&$a) { $a->data['contact'] = $r[0]; return; -} + } /*contact actions*/ -if(! function_exists('_contact_update')) { function _contact_update($contact_id) { $r = q("SELECT `uid`, `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id)); if (!$r) @@ -242,9 +239,7 @@ function _contact_update($contact_id) { // pull feed and consume it, which should subscribe to the hub. proc_run('php',"include/onepoll.php","$contact_id", "force"); } -} -if(! function_exists('_contact_update_profile')) { function _contact_update_profile($contact_id) { $r = q("SELECT `uid`, `url`, `network` FROM `contact` WHERE `id` = %d", intval($contact_id)); if (!$r) @@ -304,9 +299,7 @@ function _contact_update_profile($contact_id) { // Update the entry in the gcontact table update_gcontact_from_probe($data["url"]); } -} -if(! function_exists('_contact_block')) { function _contact_block($contact_id, $orig_record) { $blocked = (($orig_record['blocked']) ? 0 : 1); $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d", @@ -315,10 +308,8 @@ function _contact_block($contact_id, $orig_record) { intval(local_user()) ); return $r; -} -} -if(! function_exists('_contact_ignore')) { +} function _contact_ignore($contact_id, $orig_record) { $readonly = (($orig_record['readonly']) ? 0 : 1); $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d", @@ -328,9 +319,6 @@ function _contact_ignore($contact_id, $orig_record) { ); return $r; } -} - -if(! function_exists('_contact_archive')) { function _contact_archive($contact_id, $orig_record) { $archived = (($orig_record['archive']) ? 0 : 1); $r = q("UPDATE `contact` SET `archive` = %d WHERE `id` = %d AND `uid` = %d", @@ -343,18 +331,14 @@ function _contact_archive($contact_id, $orig_record) { } return $r; } -} - -if(! function_exists('_contact_drop')) { function _contact_drop($contact_id, $orig_record) { $a = get_app(); terminate_friendship($a->user,$a->contact,$orig_record); contact_remove($orig_record['id']); } -} -if(! function_exists('contacts_content')) { + function contacts_content(&$a) { $sort_type = 0; @@ -815,9 +799,7 @@ function contacts_content(&$a) { return $o; } -} -if(! function_exists('contacts_tab')) { function contacts_tab($a, $contact_id, $active_tab) { // tabs $tabs = array( @@ -891,9 +873,7 @@ function contacts_tab($a, $contact_id, $active_tab) { return $tab_str; } -} -if(! function_exists('contact_posts')) { function contact_posts($a, $contact_id) { $r = q("SELECT `url` FROM `contact` WHERE `id` = %d", intval($contact_id)); @@ -921,9 +901,7 @@ function contact_posts($a, $contact_id) { return $o; } -} -if(! function_exists('_contact_detail_for_template')) { function _contact_detail_for_template($rr){ $community = ''; @@ -974,5 +952,5 @@ function _contact_detail_for_template($rr){ 'url' => $url, 'network' => network_to_name($rr['network'], $rr['url']), ); -} + } diff --git a/mod/content.php b/mod/content.php index ab0fe7e4bf..c5a5556116 100644 --- a/mod/content.php +++ b/mod/content.php @@ -15,7 +15,7 @@ // fast - e.g. one or two milliseconds to fetch parent items for the current content, // and 10-20 milliseconds to fetch all the child items. -if(! function_exists('content_content')) { + function content_content(&$a, $update = 0) { require_once('include/conversation.php'); @@ -61,7 +61,7 @@ function content_content(&$a, $update = 0) { $o = ''; - + $contact_id = $a->cid; @@ -100,7 +100,7 @@ function content_content(&$a, $update = 0) { $def_acl = array('allow_cid' => $str); } - + $sql_options = (($star) ? " and starred = 1 " : ''); $sql_options .= (($bmark) ? " and bookmark = 1 " : ''); @@ -137,7 +137,7 @@ function content_content(&$a, $update = 0) { } elseif($cid) { - $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d + $r = q("SELECT `id`,`name`,`network`,`writable`,`nurl` FROM `contact` WHERE `id` = %d AND `blocked` = 0 AND `pending` = 0 LIMIT 1", intval($cid) ); @@ -304,9 +304,9 @@ function content_content(&$a, $update = 0) { echo json_encode($o); killme(); } -} -if(! function_exists('render_content')) { + + function render_content(&$a, $items, $mode, $update, $preview = false) { require_once('include/bbcode.php'); @@ -373,7 +373,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { if($mode === 'network-new' || $mode === 'search' || $mode === 'community') { - // "New Item View" on network page or search page results + // "New Item View" on network page or search page results // - just loop through the items and format them minimally for display //$tpl = get_markup_template('search_item.tpl'); @@ -389,7 +389,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $sparkle = ''; if($mode === 'search' || $mode === 'community') { - if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) + if(((activity_match($item['verb'],ACTIVITY_LIKE)) || (activity_match($item['verb'],ACTIVITY_DISLIKE))) && ($item['id'] != $item['parent'])) continue; $nickname = $item['nickname']; @@ -436,7 +436,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $drop = array( 'dropping' => $dropping, - 'select' => t('Select'), + 'select' => t('Select'), 'delete' => t('Delete'), ); @@ -526,11 +526,11 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $comments[$item['parent']] = 1; else $comments[$item['parent']] += 1; - } elseif(! x($comments,$item['parent'])) + } elseif(! x($comments,$item['parent'])) $comments[$item['parent']] = 0; // avoid notices later on } - // map all the like/dislike activities for each parent item + // map all the like/dislike activities for each parent item // Store these in the $alike and $dlike arrays foreach($items as $item) { @@ -617,14 +617,14 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $redirect_url = $a->get_baseurl($ssl_state) . '/redir/' . $item['cid'] ; - $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) + $lock = ((($item['private'] == 1) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid'])))) ? t('Private Message') : false); // Top-level wall post not written by the wall owner (wall-to-wall) - // First figure out who owns it. + // First figure out who owns it. $osparkle = ''; @@ -651,13 +651,13 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { if((! $owner_linkmatch) && (! $alias_linkmatch) && (! $owner_namematch)) { // The author url doesn't match the owner (typically the contact) - // and also doesn't match the contact alias. - // The name match is a hack to catch several weird cases where URLs are + // and also doesn't match the contact alias. + // The name match is a hack to catch several weird cases where URLs are // all over the park. It can be tricked, but this prevents you from // seeing "Bob Smith to Bob Smith via Wall-to-wall" and you know darn - // well that it's the same Bob Smith. + // well that it's the same Bob Smith. - // But it could be somebody else with the same name. It just isn't highly likely. + // But it could be somebody else with the same name. It just isn't highly likely. $owner_url = $item['owner-link']; @@ -666,7 +666,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $template = $wallwall; $commentww = 'ww'; // If it is our contact, use a friendly redirect link - if((link_compare($item['owner-link'],$item['url'])) + if((link_compare($item['owner-link'],$item['url'])) && ($item['network'] === NETWORK_DFRN)) { $owner_url = $redirect_url; $osparkle = ' sparkle'; @@ -678,7 +678,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { } $likebuttons = ''; - $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false); + $shareable = ((($profile_owner == local_user()) && ($item['private'] != 1)) ? true : false); if($page_writeable) { /* if($toplevelpost) { */ @@ -698,7 +698,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { if(($show_comment_box) || (($show_comment_box == false) && ($override_comment_box == false) && ($item['last-child']))) { $comment = replace_macros($cmnt_tpl,array( - '$return_path' => '', + '$return_path' => '', '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''), '$type' => (($mode === 'profile') ? 'wall-comment' : 'net-comment'), '$id' => $item['item_id'], @@ -739,7 +739,7 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $drop = array( 'dropping' => $dropping, - 'select' => t('Select'), + 'select' => t('Select'), 'delete' => t('Delete'), ); @@ -805,9 +805,9 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { $shiny = ""; if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0) - $shiny = 'shiny'; + $shiny = 'shiny'; - // + // localize_item($item); @@ -897,5 +897,5 @@ function render_content(&$a, $items, $mode, $update, $preview = false) { return $threads; -} + } diff --git a/mod/credits.php b/mod/credits.php index 8e6321760b..f8cfb03f37 100644 --- a/mod/credits.php +++ b/mod/credits.php @@ -5,7 +5,6 @@ * addons repository will be listed though ATM) */ -if(! function_exists('credits_content')) { function credits_content (&$a) { /* fill the page with credits */ $f = fopen('util/credits.txt','r'); @@ -19,4 +18,3 @@ function credits_content (&$a) { '$names' => $arr, )); } -} diff --git a/mod/crepair.php b/mod/crepair.php index 50502b4987..5b4db09dac 100644 --- a/mod/crepair.php +++ b/mod/crepair.php @@ -2,7 +2,6 @@ require_once("include/contact_selectors.php"); require_once("mod/contacts.php"); -if(! function_exists('crepair_init')) { function crepair_init(&$a) { if(! local_user()) return; @@ -29,9 +28,8 @@ function crepair_init(&$a) { profile_load($a, "", 0, get_contact_details_by_url($contact["url"])); } } -} -if(! function_exists('crepair_post')) { + function crepair_post(&$a) { if(! local_user()) return; @@ -93,9 +91,9 @@ function crepair_post(&$a) { return; } -} -if(! function_exists('crepair_content')) { + + function crepair_content(&$a) { if(! local_user()) { @@ -182,5 +180,5 @@ function crepair_content(&$a) { )); return $o; -} + } diff --git a/mod/delegate.php b/mod/delegate.php index d421de3764..20d2e605e0 100644 --- a/mod/delegate.php +++ b/mod/delegate.php @@ -1,13 +1,11 @@ get_baseurl())), intval(local_user()), dbesc(NETWORK_DFRN) - ); + ); if(! count($r)) { notice( t('No potential page delegates located.') . EOL); @@ -146,5 +144,5 @@ function delegate_content(&$a) { return $o; -} + } diff --git a/mod/dfrn_confirm.php b/mod/dfrn_confirm.php index 00e215e334..27c04a908d 100644 --- a/mod/dfrn_confirm.php +++ b/mod/dfrn_confirm.php @@ -16,7 +16,6 @@ require_once('include/enotify.php'); -if(! function_exists('dfrn_confirm_post')) { function dfrn_confirm_post(&$a,$handsfree = null) { if(is_array($handsfree)) { @@ -802,5 +801,5 @@ function dfrn_confirm_post(&$a,$handsfree = null) { goaway(z_root()); // NOTREACHED -} + } diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 04500e89ad..4aa777b550 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -5,7 +5,6 @@ require_once('include/event.php'); require_once('library/defuse/php-encryption-1.2.1/Crypto.php'); -if(! function_exists('dfrn_notify_post')) { function dfrn_notify_post(&$a) { logger(__function__, LOGGER_TRACE); $dfrn_id = ((x($_POST,'dfrn_id')) ? notags(trim($_POST['dfrn_id'])) : ''); @@ -214,9 +213,8 @@ function dfrn_notify_post(&$a) { // NOTREACHED } -} -if(! function_exists('dfrn_notify_content')) { + function dfrn_notify_content(&$a) { if(x($_GET,'dfrn_id')) { @@ -340,5 +338,5 @@ function dfrn_notify_content(&$a) { killme(); } -} + } diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index 82c75d28cf..ab6637607e 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -3,7 +3,7 @@ require_once('include/items.php'); require_once('include/auth.php'); require_once('include/dfrn.php'); -if(! function_exists('dfrn_poll_init')) { + function dfrn_poll_init(&$a) { @@ -160,7 +160,7 @@ function dfrn_poll_init(&$a) { if($final_dfrn_id != $orig_id) { logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG); - // did not decode properly - cannot trust this site + // did not decode properly - cannot trust this site xml_status(3, 'Bad decryption'); } @@ -195,11 +195,11 @@ function dfrn_poll_init(&$a) { return; // NOTREACHED } } -} + } -if(! function_exists('dfrn_poll_post')) { + function dfrn_poll_post(&$a) { $dfrn_id = ((x($_POST,'dfrn_id')) ? $_POST['dfrn_id'] : ''); @@ -257,7 +257,7 @@ function dfrn_poll_post(&$a) { if($final_dfrn_id != $orig_id) { logger('profile_check: ' . $final_dfrn_id . ' != ' . $orig_id, LOGGER_DEBUG); - // did not decode properly - cannot trust this site + // did not decode properly - cannot trust this site xml_status(3, 'Bad decryption'); } @@ -377,9 +377,7 @@ function dfrn_poll_post(&$a) { } } -} -if(! function_exists('dfrn_poll_content')) { function dfrn_poll_content(&$a) { $dfrn_id = ((x($_GET,'dfrn_id')) ? $_GET['dfrn_id'] : ''); @@ -564,4 +562,3 @@ function dfrn_poll_content(&$a) { } } } -} diff --git a/mod/directory.php b/mod/directory.php index 7ce1530efc..294a55585d 100644 --- a/mod/directory.php +++ b/mod/directory.php @@ -1,5 +1,5 @@ set_pager_itemspage(60); @@ -16,23 +16,23 @@ function directory_init(&$a) { unset($_SESSION['mobile-theme']); } -} + } -if(! function_exists('directory_post')) { + function directory_post(&$a) { if(x($_POST,'search')) $a->data['search'] = $_POST['search']; } -} -if(! function_exists('directory_content')) { + + function directory_content(&$a) { global $db; require_once("mod/proxy.php"); - if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || + if((get_config('system','block_public')) && (! local_user()) && (! remote_user()) || (get_config('system','block_local_dir')) && (! local_user()) && (! remote_user())) { notice( t('Public access denied.') . EOL); return; @@ -123,14 +123,14 @@ function directory_content(&$a) { } // if(strlen($rr['dob'])) { // if(($years = age($rr['dob'],$rr['timezone'],'')) != 0) -// $details .= '
' . t('Age: ') . $years ; +// $details .= '
' . t('Age: ') . $years ; // } // if(strlen($rr['gender'])) // $details .= '
' . t('Gender: ') . $rr['gender']; // show if account is a community account - /// @TODO The other page types should be also respected, but first we need a good + /// @TODO The other page types should be also respected, but first we need a good /// translatiion and systemwide consistency for displaying the page type if((intval($rr['page-flags']) == PAGE_COMMUNITY) OR (intval($rr['page-flags']) == PAGE_PRVGROUP)) $community = true; @@ -158,7 +158,7 @@ function directory_content(&$a) { else { $location_e = $location; } - + $photo_menu = array(array(t("View Profile"), zrl($profile_link))); $entry = array( @@ -217,4 +217,3 @@ function directory_content(&$a) { return $o; } -} diff --git a/mod/dirfind.php b/mod/dirfind.php index f5e90705b7..0dfe4d67a9 100644 --- a/mod/dirfind.php +++ b/mod/dirfind.php @@ -5,7 +5,6 @@ require_once('include/Contact.php'); require_once('include/contact_selectors.php'); require_once('mod/contacts.php'); -if(! function_exists('dirfind_init')) { function dirfind_init(&$a) { if(! local_user()) { @@ -20,9 +19,9 @@ function dirfind_init(&$a) { $a->page['aside'] .= follow_widget(); } -} -if(! function_exists('dirfind_content')) { + + function dirfind_content(&$a, $prefix = "") { $community = false; @@ -236,4 +235,3 @@ function dirfind_content(&$a, $prefix = "") { return $o; } -} diff --git a/mod/display.php b/mod/display.php index 9995a2b3ef..4e33927072 100644 --- a/mod/display.php +++ b/mod/display.php @@ -1,5 +1,5 @@ array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')), '$submit' => t('Save'), )); - + echo $o; } killme(); } -} diff --git a/mod/filerm.php b/mod/filerm.php index be3456b58d..c266082c8f 100644 --- a/mod/filerm.php +++ b/mod/filerm.php @@ -1,6 +1,5 @@ argv[1]=="json"){ $register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN'); @@ -57,9 +56,9 @@ function friendica_init(&$a) { killme(); } } -} -if(! function_exists('friendica_content')) { + + function friendica_content(&$a) { $o = ''; @@ -71,7 +70,7 @@ function friendica_content(&$a) { $o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' '; $o .= t('running at web location') . ' ' . z_root() . '

'; - $o .= t('Please visit Friendica.com to learn more about the Friendica project.') . '

'; + $o .= t('Please visit Friendica.com to learn more about the Friendica project.') . '

'; $o .= t('Bug reports and issues: please visit') . ' ' . ''.t('the bugtracker at github').'

'; $o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '

'; @@ -103,8 +102,8 @@ function friendica_content(&$a) { else $o .= '

' . t('No installed plugins/addons/apps') . '

'; - call_hooks('about_hook', $o); + call_hooks('about_hook', $o); return $o; -} + } diff --git a/mod/fsuggest.php b/mod/fsuggest.php index 26a5e98063..6b1cbd7533 100644 --- a/mod/fsuggest.php +++ b/mod/fsuggest.php @@ -1,6 +1,6 @@ '; - $o .= contact_selector('suggest','suggest-select', false, + $o .= contact_selector('suggest','suggest-select', false, array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true)); @@ -109,4 +109,3 @@ function fsuggest_content(&$a) { return $o; } -} diff --git a/mod/group.php b/mod/group.php index 2f8053eefb..5b28784f56 100644 --- a/mod/group.php +++ b/mod/group.php @@ -1,21 +1,18 @@ page['aside'] = group_side('contacts','group','extended',(($a->argc > 1) ? intval($a->argv[1]) : 0)); } } -} -if(! function_exists('group_post')) { + + function group_post(&$a) { if(! local_user()) { @@ -67,9 +64,7 @@ function group_post(&$a) { } return; } -} -if(! function_exists('group_content')) { function group_content(&$a) { $change = false; @@ -234,5 +229,5 @@ function group_content(&$a) { } return replace_macros($tpl, $context); -} + } diff --git a/mod/hcard.php b/mod/hcard.php index af49423de3..6d2d9e2ebf 100644 --- a/mod/hcard.php +++ b/mod/hcard.php @@ -1,6 +1,5 @@ argc > 2) && ($a->argv[2] === 'view')) { $which = $a->user['nickname']; - $profile = $a->argv[1]; + $profile = $a->argv[1]; } profile_load($a,$which,$profile); @@ -24,7 +23,7 @@ function hcard_init(&$a) { if((x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY)) { $a->page['htmlhead'] .= ''; } - if(x($a->profile,'openidserver')) + if(x($a->profile,'openidserver')) $a->page['htmlhead'] .= '' . "\r\n"; if(x($a->profile,'openid')) { $delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']); @@ -43,9 +42,10 @@ function hcard_init(&$a) { $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : '')); $a->page['htmlhead'] .= '' . "\r\n"; header('Link: <' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); - + $dfrn_pages = array('request', 'confirm', 'notify', 'poll'); foreach($dfrn_pages as $dfrn) $a->page['htmlhead'] .= "get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n"; + } -} + diff --git a/mod/help.php b/mod/help.php index 320e622fa5..5465d3e900 100644 --- a/mod/help.php +++ b/mod/help.php @@ -18,7 +18,6 @@ if (!function_exists('load_doc_file')) { } -if(! function_exists('help_content')) { function help_content(&$a) { nav_set_selected('help'); @@ -99,5 +98,5 @@ function help_content(&$a) { } ".$html; return $html; -} + } diff --git a/mod/hostxrd.php b/mod/hostxrd.php index 5b178e9b8f..4121764f1a 100644 --- a/mod/hostxrd.php +++ b/mod/hostxrd.php @@ -2,7 +2,6 @@ require_once('include/crypto.php'); -if(! function_exists('hostxrd_init')) { function hostxrd_init(&$a) { header('Access-Control-Allow-Origin: *'); header("Content-type: text/xml"); @@ -28,5 +27,5 @@ function hostxrd_init(&$a) { )); session_write_close(); exit(); -} + } diff --git a/mod/ignored.php b/mod/ignored.php index 8a681a1154..e876b4ef8b 100644 --- a/mod/ignored.php +++ b/mod/ignored.php @@ -1,6 +1,6 @@ config['system']['theme'] = "../install"; $a->theme['stylesheet'] = $a->get_baseurl()."/view/install/style.css"; - - - + + + global $install_wizard_pass; if (x($_POST,'pass')) $install_wizard_pass = intval($_POST['pass']); -} + } -if(! function_exists('install_post')) { function install_post(&$a) { global $install_wizard_pass, $db; @@ -113,18 +112,14 @@ function install_post(&$a) { break; } } -} -if(! function_exists('get_db_errno')) { function get_db_errno() { if(class_exists('mysqli')) return mysqli_connect_errno(); else return mysql_errno(); } -} -if(! function_exists('install_content')) { function install_content(&$a) { global $install_wizard_pass, $db; @@ -309,7 +304,6 @@ function install_content(&$a) { } } -} /** * checks : array passed to template @@ -318,8 +312,7 @@ function install_content(&$a) { * required : boolean * help : string optional */ -if(! function_exists('check_add')) { -function check_add(&$checks, $title, $status, $required, $help) { +function check_add(&$checks, $title, $status, $required, $help){ $checks[] = array( 'title' => $title, 'status' => $status, @@ -327,9 +320,7 @@ function check_add(&$checks, $title, $status, $required, $help) { 'help' => $help, ); } -} -if(! function_exists('check_php')) { function check_php(&$phpath, &$checks) { $passed = $passed2 = $passed3 = false; if (strlen($phpath)){ @@ -379,10 +370,9 @@ function check_php(&$phpath, &$checks) { check_add($checks, t('PHP register_argc_argv'), $passed3, true, $help); } -} + } -if(! function_exists('check_keys')) { function check_keys(&$checks) { $help = ''; @@ -402,10 +392,10 @@ function check_keys(&$checks) { $help .= t('If running under Windows, please see "http://www.php.net/manual/en/openssl.installation.php".'); } check_add($checks, t('Generate encryption keys'), $res, true, $help); -} + } -if(! function_exists('check_funcs')) { + function check_funcs(&$checks) { $ck_funcs = array(); check_add($ck_funcs, t('libCurl PHP module'), true, true, ""); @@ -467,9 +457,8 @@ function check_funcs(&$checks) { /*if((x($_SESSION,'sysmsg')) && is_array($_SESSION['sysmsg']) && count($_SESSION['sysmsg'])) notice( t('Please see the file "INSTALL.txt".') . EOL);*/ } -} -if(! function_exists('check_htconfig')) { + function check_htconfig(&$checks) { $status = true; $help = ""; @@ -484,10 +473,9 @@ function check_htconfig(&$checks) { } check_add($checks, t('.htconfig.php is writable'), $status, false, $help); -} + } -if(! function_exists('check_smarty3')) { function check_smarty3(&$checks) { $status = true; $help = ""; @@ -501,10 +489,9 @@ function check_smarty3(&$checks) { } check_add($checks, t('view/smarty3 is writable'), $status, true, $help); -} + } -if(! function_exists('check_htaccess')) { function check_htaccess(&$checks) { $a = get_app(); $status = true; @@ -524,9 +511,7 @@ function check_htaccess(&$checks) { // cannot check modrewrite if libcurl is not installed } } -} -if(! function_exists('check_imagik')) { function check_imagik(&$checks) { $imagick = false; $gif = false; @@ -543,18 +528,16 @@ function check_imagik(&$checks) { check_add($checks, t('ImageMagick supports GIF'), $gif, false, ""); } } -} -if(! function_exists('manual_config')) { + + function manual_config(&$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 .= ""; return $o; } -} -if(! function_exists('load_database_rem')) { function load_database_rem($v, $i){ $l = trim($i); if (strlen($l)>1 && ($l[0]=="-" || ($l[0]=="/" && $l[1]=="*"))){ @@ -563,9 +546,8 @@ function load_database_rem($v, $i){ return $v."\n".$i; } } -} -if(! function_exists('load_database')) { + function load_database($db) { require_once("include/dbstructure.php"); @@ -585,9 +567,7 @@ function load_database($db) { return $errors; } -} -if(! function_exists('what_next')) { function what_next() { $a = get_app(); $baseurl = $a->get_baseurl(); @@ -599,4 +579,5 @@ function what_next() { .t("Go to your new Friendica node registration page and register as new user. Remember to use the same email you have entered as administrator email. This will allow you to enter the site admin panel.") ."

"; } -} + + diff --git a/mod/invite.php b/mod/invite.php index 1f559dabc0..ccf876c7c0 100644 --- a/mod/invite.php +++ b/mod/invite.php @@ -9,7 +9,6 @@ require_once('include/email.php'); -if(! function_exists('invite_post')) { function invite_post(&$a) { if(! local_user()) { @@ -50,7 +49,7 @@ function invite_post(&$a) { notice( sprintf( t('%s : Not a valid email address.'), $recip) . EOL); continue; } - + if($invonly && ($x || is_site_admin())) { $code = autoname(8) . srand(1000,9999); $nmessage = str_replace('$invite_code',$code,$message); @@ -71,8 +70,8 @@ function invite_post(&$a) { else $nmessage = $message; - $res = mail($recip, email_header_encode( t('Please join us on Friendica'),'UTF-8'), - $nmessage, + $res = mail($recip, email_header_encode( t('Please join us on Friendica'),'UTF-8'), + $nmessage, "From: " . $a->user['email'] . "\n" . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); @@ -94,9 +93,8 @@ function invite_post(&$a) { notice( sprintf( tt("%d message sent.", "%d messages sent.", $total) , $total) . EOL); return; } -} -if(! function_exists('invite_content')) { + function invite_content(&$a) { if(! local_user()) { @@ -136,7 +134,7 @@ function invite_content(&$a) { '$msg_text' => t('Your message:'), '$default_message' => t('You are cordially invited to join me and other close friends on Friendica - and help us to create a better social web.') . "\r\n" . "\r\n" . $linktxt - . "\r\n" . "\r\n" . (($invonly) ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') .t('Once you have registered, please connect with me via my profile page at:') + . "\r\n" . "\r\n" . (($invonly) ? t('You will need to supply this invitation code: $invite_code') . "\r\n" . "\r\n" : '') .t('Once you have registered, please connect with me via my profile page at:') . "\r\n" . "\r\n" . $a->get_baseurl() . '/profile/' . $a->user['nickname'] . "\r\n" . "\r\n" . t('For more information about the Friendica project and why we feel it is important, please visit http://friendica.com') . "\r\n" . "\r\n" , '$submit' => t('Submit') @@ -144,4 +142,3 @@ function invite_content(&$a) { return $o; } -} diff --git a/mod/item.php b/mod/item.php index f8f2e0fafe..8c5a479646 100644 --- a/mod/item.php +++ b/mod/item.php @@ -25,7 +25,6 @@ require_once('include/text.php'); require_once('include/items.php'); require_once('include/Scrape.php'); -if(! function_exists('item_post')) { function item_post(&$a) { if((! local_user()) && (! remote_user()) && (! x($_REQUEST,'commenter'))) @@ -1018,9 +1017,7 @@ function item_post(&$a) { item_post_return($a->get_baseurl(), $api_source, $return_path); // NOTREACHED } -} -if(! function_exists('item_post_return')) { function item_post_return($baseurl, $api_source, $return_path) { // figure out how to return, depending on from whence we came @@ -1040,9 +1037,9 @@ function item_post_return($baseurl, $api_source, $return_path) { echo json_encode($json); killme(); } -} -if(! function_exists('item_content')) { + + function item_content(&$a) { if((! local_user()) && (! remote_user())) @@ -1061,7 +1058,6 @@ function item_content(&$a) { } return $o; } -} /** * This function removes the tag $tag from the text $body and replaces it with @@ -1075,7 +1071,6 @@ function item_content(&$a) { * * @return boolean true if replaced, false if not replaced */ -if(! function_exists('handle_tag')) { function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $network = "") { require_once("include/Scrape.php"); require_once("include/socgraph.php"); @@ -1250,9 +1245,8 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag, $netwo return array('replaced' => $replaced, 'contact' => $r[0]); } -} -if(! function_exists('store_diaspora_comment_sig')) { + function store_diaspora_comment_sig($datarray, $author, $uprvkey, $parent_item, $post_id) { // We won't be able to sign Diaspora comments for authenticated visitors - we don't have their private key @@ -1290,4 +1284,3 @@ function store_diaspora_comment_sig($datarray, $author, $uprvkey, $parent_item, return; } -} diff --git a/mod/like.php b/mod/like.php index ef483a1f9e..8d383b9abe 100755 --- a/mod/like.php +++ b/mod/like.php @@ -5,7 +5,6 @@ require_once('include/bbcode.php'); require_once('include/items.php'); require_once('include/like.php'); -if(! function_exists('like_content')) { function like_content(&$a) { if(! local_user() && ! remote_user()) { return false; @@ -29,11 +28,11 @@ function like_content(&$a) { killme(); // NOTREACHED // return; // NOTREACHED } -} + // Decide how to return. If we were called with a 'return' argument, // then redirect back to the calling page. If not, just quietly end -if(! function_exists('like_content_return')) { + function like_content_return($baseurl, $return_path) { if($return_path) { @@ -46,4 +45,4 @@ function like_content_return($baseurl, $return_path) { killme(); } -} + diff --git a/mod/localtime.php b/mod/localtime.php index fc500f4dd9..d1453bc527 100644 --- a/mod/localtime.php +++ b/mod/localtime.php @@ -2,7 +2,7 @@ require_once('include/datetime.php'); -if(! function_exists('localtime_post')) { + function localtime_post(&$a) { $t = $_REQUEST['time']; @@ -13,10 +13,9 @@ function localtime_post(&$a) { if($_POST['timezone']) $a->data['mod-localtime'] = datetime_convert('UTC',$_POST['timezone'],$t,$bd_format); -} + } -if(! function_exists('localtime_content')) { function localtime_content(&$a) { $t = $_REQUEST['time']; if(! $t) @@ -39,12 +38,12 @@ function localtime_content(&$a) { $o .= '
'; - $o .= '

' . t('Please select your timezone:') . '

'; + $o .= '

' . t('Please select your timezone:') . '

'; $o .= select_timezone(($_REQUEST['timezone']) ? $_REQUEST['timezone'] : 'America/Los_Angeles'); $o .= '
'; return $o; -} -} + +} \ No newline at end of file diff --git a/mod/lockview.php b/mod/lockview.php index 82f93f4985..0ae54c8c12 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -1,8 +1,8 @@ argc > 1) ? $a->argv[1] : 0); if (is_numeric($type)) { $item_id = intval($type); @@ -10,13 +10,13 @@ function lockview_content(&$a) { } else { $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0); } - + if(! $item_id) killme(); if (!in_array($type, array('item','photo','event'))) killme(); - + $r = q("SELECT * FROM `%s` WHERE `id` = %d LIMIT 1", dbesc($type), intval($item_id) @@ -33,7 +33,7 @@ function lockview_content(&$a) { } - if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) + if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) && (! strlen($item['deny_cid'])) && (! strlen($item['deny_gid']))) { echo t('Remote privacy information not available.') . '
'; @@ -53,7 +53,7 @@ function lockview_content(&$a) { dbesc(implode(', ', $allowed_groups)) ); if(count($r)) - foreach($r as $rr) + foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } if(count($allowed_users)) { @@ -61,7 +61,7 @@ function lockview_content(&$a) { dbesc(implode(', ',$allowed_users)) ); if(count($r)) - foreach($r as $rr) + foreach($r as $rr) $l[] = $rr['name']; } @@ -71,7 +71,7 @@ function lockview_content(&$a) { dbesc(implode(', ', $deny_groups)) ); if(count($r)) - foreach($r as $rr) + foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } if(count($deny_users)) { @@ -79,12 +79,12 @@ function lockview_content(&$a) { dbesc(implode(', ',$deny_users)) ); if(count($r)) - foreach($r as $rr) + foreach($r as $rr) $l[] = '' . $rr['name'] . ''; } echo $o . implode(', ', $l); killme(); -} + } diff --git a/mod/login.php b/mod/login.php index 47c329eb63..d09fc1868f 100644 --- a/mod/login.php +++ b/mod/login.php @@ -1,5 +1,5 @@ config['register_policy'] == REGISTER_CLOSED) ? false : true); -} + } diff --git a/mod/lostpass.php b/mod/lostpass.php index 0c4bb1a833..938d1cbb00 100644 --- a/mod/lostpass.php +++ b/mod/lostpass.php @@ -4,7 +4,6 @@ require_once('include/email.php'); require_once('include/enotify.php'); require_once('include/text.php'); -if(! function_exists('lostpass_post')) { function lostpass_post(&$a) { $loginame = notags(trim($_POST['login-name'])); @@ -75,10 +74,10 @@ function lostpass_post(&$a) { 'body' => $body)); goaway(z_root()); -} + } -if(! function_exists('lostpass_content')) { + function lostpass_content(&$a) { @@ -165,5 +164,5 @@ function lostpass_content(&$a) { return $o; } -} + } diff --git a/mod/maintenance.php b/mod/maintenance.php index 02de29108f..b50c94c9b9 100644 --- a/mod/maintenance.php +++ b/mod/maintenance.php @@ -1,8 +1,7 @@ t('System down for maintenance') )); } -} diff --git a/mod/manage.php b/mod/manage.php index 6af3db9971..adcc3d787a 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -2,7 +2,7 @@ require_once("include/text.php"); -if(! function_exists('manage_post')) { + function manage_post(&$a) { if(! local_user()) @@ -87,9 +87,9 @@ function manage_post(&$a) { goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] ); // NOTREACHED } -} -if(! function_exists('manage_content')) { + + function manage_content(&$a) { if(! local_user()) { @@ -144,5 +144,5 @@ function manage_content(&$a) { )); return $o; -} + } diff --git a/mod/match.php b/mod/match.php index f4936b28dc..3b0367b429 100644 --- a/mod/match.php +++ b/mod/match.php @@ -13,7 +13,6 @@ require_once('mod/proxy.php'); * @param App &$a * @return void|string */ -if(! function_exists('match_content')) { function match_content(&$a) { $o = ''; @@ -110,4 +109,3 @@ function match_content(&$a) { return $o; } -} diff --git a/mod/message.php b/mod/message.php index 1f11797d8b..1724ebc424 100644 --- a/mod/message.php +++ b/mod/message.php @@ -3,7 +3,6 @@ require_once('include/acl_selectors.php'); require_once('include/message.php'); -if(! function_exists('message_init')) { function message_init(&$a) { $tabs = ''; @@ -37,10 +36,9 @@ function message_init(&$a) { '$baseurl' => $a->get_baseurl(true), '$base' => $base )); -} + } -if(! function_exists('message_post')) { function message_post(&$a) { if(! local_user()) { @@ -93,7 +91,7 @@ function message_post(&$a) { } else goaway($a->get_baseurl(true) . '/' . $_SESSION['return_url']); -} + } // Note: the code in 'item_extract_images' and 'item_redir_and_replace_images' @@ -173,7 +171,7 @@ function item_redir_and_replace_images($body, $images, $cid) { }} -if(! function_exists('message_content')) { + function message_content(&$a) { $o = ''; @@ -532,9 +530,7 @@ function message_content(&$a) { return $o; } } -} -if(! function_exists('get_messages')) { function get_messages($user, $lstart, $lend) { return q("SELECT max(`mail`.`created`) AS `mailcreated`, min(`mail`.`seen`) AS `mailseen`, @@ -545,9 +541,7 @@ function get_messages($user, $lstart, $lend) { intval($user), intval($lstart), intval($lend) ); } -} -if(! function_exists('render_messages')) { function render_messages($msg, $t) { $a = get_app(); @@ -599,4 +593,3 @@ function render_messages($msg, $t) { return $rslt; } -} diff --git a/mod/modexp.php b/mod/modexp.php index 282d55a24b..bba2c2882d 100644 --- a/mod/modexp.php +++ b/mod/modexp.php @@ -2,7 +2,6 @@ require_once('library/asn1.php'); -if(! function_exists('modexp_init')) { function modexp_init(&$a) { if($a->argc != 2) @@ -30,5 +29,6 @@ function modexp_init(&$a) { echo 'RSA' . '.' . $m . '.' . $e ; killme(); + } -} + diff --git a/mod/mood.php b/mod/mood.php index 2476f06562..eee11e20c5 100644 --- a/mod/mood.php +++ b/mod/mood.php @@ -4,7 +4,7 @@ require_once('include/security.php'); require_once('include/bbcode.php'); require_once('include/items.php'); -if(! function_exists('mood_init')) { + function mood_init(&$a) { if(! local_user()) @@ -59,7 +59,7 @@ function mood_init(&$a) { $uri = item_new_uri($a->get_hostname(),$uid); - $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]); + $action = sprintf( t('%1$s is currently %2$s'), '[url=' . $poster['url'] . ']' . $poster['name'] . '[/url]' , $verbs[$verb]); $arr = array(); @@ -105,9 +105,9 @@ function mood_init(&$a) { return; } -} -if(! function_exists('mood_content')) { + + function mood_content(&$a) { if(! local_user()) { @@ -138,5 +138,5 @@ function mood_content(&$a) { )); return $o; -} + } diff --git a/mod/msearch.php b/mod/msearch.php index 3b1b0b617a..89de5b7057 100644 --- a/mod/msearch.php +++ b/mod/msearch.php @@ -1,6 +1,5 @@ $rr['name'], - 'url' => $a->get_baseurl() . '/profile/' . $rr['nickname'], + 'name' => $rr['name'], + 'url' => $a->get_baseurl() . '/profile/' . $rr['nickname'], 'photo' => $a->get_baseurl() . '/photo/avatar/' . $rr['uid'] . '.jpg', 'tags' => str_replace(array(',',' '),array(' ',' '),$rr['pub_keywords']) ); @@ -39,5 +38,5 @@ function msearch_post(&$a) { echo json_encode($output); killme(); -} -} + +} \ No newline at end of file diff --git a/mod/navigation.php b/mod/navigation.php index 8fbabfda96..5db69b171e 100644 --- a/mod/navigation.php +++ b/mod/navigation.php @@ -2,7 +2,6 @@ require_once("include/nav.php"); -if(! function_exists('navigation_content')) { function navigation_content(&$a) { $nav_info = nav_info($a); @@ -23,5 +22,5 @@ function navigation_content(&$a) { '$apps' => $a->apps, '$clear_notifs' => t('Clear notifications') )); -} + } diff --git a/mod/network.php b/mod/network.php index f9a0bec238..0010a3d824 100644 --- a/mod/network.php +++ b/mod/network.php @@ -1,6 +1,4 @@ page['aside'] .= networks_widget($a->get_baseurl(true) . '/network',(x($_GET, 'nets') ? $_GET['nets'] : '')); $a->page['aside'] .= saved_searches($search); $a->page['aside'] .= fileas_widget($a->get_baseurl(true) . '/network',(x($_GET, 'file') ? $_GET['file'] : '')); -} + } -if(! function_exists('saved_searches')) { function saved_searches($search) { if(! feature_enabled(local_user(),'savedsearch')) @@ -207,7 +204,7 @@ function saved_searches($search) { )); return $o; -} + } /** @@ -225,7 +222,6 @@ function saved_searches($search) { * * @return Array ( $no_active, $comment_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active ); */ -if(! function_exists('network_query_get_sel_tab')) { function network_query_get_sel_tab($a) { $no_active=''; $starred_active = ''; @@ -282,12 +278,10 @@ function network_query_get_sel_tab($a) { return array($no_active, $all_active, $postord_active, $conv_active, $new_active, $starred_active, $bookmarked_active, $spam_active); } -} /** * Return selected network from query */ -if(! function_exists('network_query_get_sel_net')) { function network_query_get_sel_net() { $network = false; @@ -297,9 +291,7 @@ function network_query_get_sel_net() { return $network; } -} -if(! function_exists('network_query_get_sel_group')) { function network_query_get_sel_group($a) { $group = false; @@ -309,9 +301,8 @@ function network_query_get_sel_group($a) { return $group; } -} -if(! function_exists('network_content')) { + function network_content(&$a, $update = 0) { require_once('include/conversation.php'); @@ -895,4 +886,4 @@ function network_content(&$a, $update = 0) { return $o; } -} + diff --git a/mod/newmember.php b/mod/newmember.php index ef25333302..aa55c3a098 100644 --- a/mod/newmember.php +++ b/mod/newmember.php @@ -1,6 +1,5 @@ '; - $o .= '
  • ' . '' . t('Friendica Walk-Through') . '
    ' . t('On your Quick Start page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '
  • ' . EOL; + $o .= '
  • ' . '' . t('Friendica Walk-Through') . '
    ' . t('On your Quick Start page - find a brief introduction to your profile and network tabs, make some new connections, and find some groups to join.') . '
  • ' . EOL; $o .= ''; @@ -24,7 +23,7 @@ function newmember_content(&$a) { $o .= '