Browse Source

Updated modules to allow for partial overrides without errors

Only define functions if they have not been defined before, e.g. in themes. This makes it possible to override parts of a module and still use the other functions.
tags/3.5
Andrej Stieben 4 years ago
parent
commit
db949bb802
100 changed files with 662 additions and 398 deletions
  1. +4
    -0
      mod/_well_known.php
  2. +2
    -1
      mod/acctlink.php
  3. +2
    -2
      mod/acl.php
  4. +56
    -22
      mod/admin.php
  5. +2
    -0
      mod/allfriends.php
  6. +3
    -2
      mod/amcd.php
  7. +6
    -5
      mod/api.php
  8. +17
    -19
      mod/apps.php
  9. +2
    -1
      mod/attach.php
  10. +24
    -22
      mod/babel.php
  11. +4
    -1
      mod/bookmarklet.php
  12. +9
    -2
      mod/cb.php
  13. +2
    -0
      mod/common.php
  14. +8
    -5
      mod/community.php
  15. +3
    -1
      mod/contactgroup.php
  16. +30
    -8
      mod/contacts.php
  17. +24
    -24
      mod/content.php
  18. +2
    -0
      mod/credits.php
  19. +6
    -4
      mod/crepair.php
  20. +6
    -4
      mod/delegate.php
  21. +2
    -1
      mod/dfrn_confirm.php
  22. +4
    -2
      mod/dfrn_notify.php
  23. +8
    -5
      mod/dfrn_poll.php
  24. +10
    -9
      mod/directory.php
  25. +4
    -2
      mod/dirfind.php
  26. +6
    -3
      mod/display.php
  27. +2
    -3
      mod/editpost.php
  28. +4
    -2
      mod/events.php
  29. +2
    -1
      mod/fbrowser.php
  30. +3
    -2
      mod/filer.php
  31. +2
    -0
      mod/filerm.php
  32. +4
    -0
      mod/follow.php
  33. +6
    -5
      mod/friendica.php
  34. +10
    -9
      mod/fsuggest.php
  35. +8
    -3
      mod/group.php
  36. +5
    -5
      mod/hcard.php
  37. +2
    -1
      mod/help.php
  38. +2
    -1
      mod/hostxrd.php
  39. +2
    -1
      mod/ignored.php
  40. +37
    -18
      mod/install.php
  41. +8
    -5
      mod/invite.php
  42. +10
    -3
      mod/item.php
  43. +4
    -3
      mod/like.php
  44. +6
    -5
      mod/localtime.php
  45. +10
    -10
      mod/lockview.php
  46. +2
    -2
      mod/login.php
  47. +4
    -3
      mod/lostpass.php
  48. +2
    -1
      mod/maintenance.php
  49. +4
    -4
      mod/manage.php
  50. +2
    -0
      mod/match.php
  51. +10
    -3
      mod/message.php
  52. +2
    -2
      mod/modexp.php
  53. +5
    -5
      mod/mood.php
  54. +5
    -4
      mod/msearch.php
  55. +2
    -1
      mod/navigation.php
  56. +13
    -4
      mod/network.php
  57. +6
    -4
      mod/newmember.php
  58. +7
    -4
      mod/nodeinfo.php
  59. +4
    -2
      mod/nogroup.php
  60. +2
    -1
      mod/noscrape.php
  61. +11
    -9
      mod/notes.php
  62. +5
    -4
      mod/notice.php
  63. +4
    -2
      mod/notifications.php
  64. +4
    -4
      mod/notify.php
  65. +3
    -1
      mod/oembed.php
  66. +8
    -9
      mod/oexchange.php
  67. +5
    -5
      mod/openid.php
  68. +8
    -8
      mod/opensearch.php
  69. +2
    -0
      mod/ostatus_subscribe.php
  70. +3
    -1
      mod/p.php
  71. +14
    -4
      mod/parse_url.php
  72. +2
    -0
      mod/photo.php
  73. +8
    -7
      mod/photos.php
  74. +4
    -0
      mod/ping.php
  75. +2
    -1
      mod/poco.php
  76. +6
    -6
      mod/poke.php
  77. +4
    -3
      mod/post.php
  78. +3
    -1
      mod/pretheme.php
  79. +3
    -1
      mod/probe.php
  80. +4
    -3
      mod/profile.php
  81. +13
    -13
      mod/profile_photo.php
  82. +10
    -4
      mod/profiles.php
  83. +6
    -6
      mod/profperm.php
  84. +12
    -0
      mod/proxy.php
  85. +10
    -10
      mod/pubsub.php
  86. +4
    -1
      mod/pubsubhubbub.php
  87. +2
    -1
      mod/qsearch.php
  88. +2
    -1
      mod/randprof.php
  89. +2
    -2
      mod/receive.php
  90. +4
    -2
      mod/redir.php
  91. +6
    -3
      mod/regmod.php
  92. +4
    -2
      mod/removeme.php
  93. +2
    -0
      mod/repair_ostatus.php
  94. +3
    -3
      mod/rsd_xml.php
  95. +5
    -2
      mod/salmon.php
  96. +8
    -6
      mod/search.php
  97. +2
    -1
      mod/session.php
  98. +9
    -7
      mod/settings.php
  99. +7
    -2
      mod/share.php
  100. +5
    -1
      mod/smilies.php

+ 4
- 0
mod/_well_known.php View File

@@ -2,6 +2,7 @@
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]) {
@@ -19,7 +20,9 @@ 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');
@@ -64,3 +67,4 @@ function wk_social_relay(&$a) {
echo json_encode($relay, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
exit;
}
}

+ 2
- 1
mod/acctlink.php View File

@@ -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,3 +14,4 @@ function acctlink_init(&$a) {
}
}
}
}

+ 2
- 2
mod/acl.php View File

@@ -3,8 +3,8 @@

require_once("include/acl_selectors.php");

if(! function_exists('acl_init')) {
function acl_init(&$a){
acl_lookup($a);
}


}

+ 56
- 22
mod/admin.php View File

@@ -2,7 +2,7 @@

/**
* @file mod/admin.php
*
*
* @brief Friendica admin
*/

@@ -23,6 +23,7 @@ require_once("include/text.php");
* @param App $a
*
*/
if(! function_exists('admin_post')) {
function admin_post(&$a){


@@ -110,6 +111,7 @@ function admin_post(&$a){
goaway($a->get_baseurl(true) . '/admin' );
return; // NOTREACHED
}
}

/**
* @brief Generates content of the admin panel pages
@@ -128,6 +130,7 @@ function admin_post(&$a){
* @param App $a
* @return string
*/
if(! function_exists('admin_content')) {
function admin_content(&$a) {

if(!is_site_admin()) {
@@ -245,6 +248,7 @@ function admin_content(&$a) {
return $o;
}
}
}

/**
* @brief Subpage with some stats about "the federation" network
@@ -260,6 +264,7 @@ 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
@@ -284,7 +289,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);

@@ -301,12 +306,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));
@@ -361,6 +366,7 @@ function admin_page_federation(&$a) {
'$baseurl' => $a->get_baseurl(),
));
}
}

/**
* @brief Admin Inspect Queue Page
@@ -375,6 +381,7 @@ 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;");
@@ -394,6 +401,7 @@ function admin_page_queue(&$a) {
'$entries' => $r,
));
}
}

/**
* @brief Admin Summary Page
@@ -406,6 +414,7 @@ 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(
@@ -452,12 +461,14 @@ 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;
@@ -770,6 +781,7 @@ function admin_page_site_post(&$a) {
return; // NOTREACHED

}
}

/**
* @brief Generate Admin Site subpage
@@ -779,6 +791,7 @@ function admin_page_site_post(&$a) {
* @param App $a
* @return string
*/
if(! function_exists('admin_page_site')) {
function admin_page_site(&$a) {

/* Installed langs */
@@ -983,7 +996,7 @@ function admin_page_site(&$a) {
'$form_security_token' => get_form_security_token("admin_site")

));
}
}

/**
@@ -998,6 +1011,7 @@ function admin_page_site(&$a) {
* @param App $a
* @return string
**/
if(! function_exists('admin_page_dbsync')) {
function admin_page_dbsync(&$a) {

$o = '';
@@ -1073,14 +1087,15 @@ 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() );
@@ -1171,6 +1186,7 @@ function admin_page_users_post(&$a){
goaway($a->get_baseurl(true) . '/admin/users' );
return; // NOTREACHED
}
}

/**
* @brief Admin panel subpage for User management
@@ -1184,6 +1200,7 @@ 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];
@@ -1336,7 +1353,7 @@ function admin_page_users(&$a){
$o .= paginate($a);
return $o;
}
}

/**
* @brief Plugins admin page
@@ -1354,6 +1371,7 @@ function admin_page_users(&$a){
* @param App $a
* @return string
*/
if(! function_exists('admin_page_plugins')) {
function admin_page_plugins(&$a){

/*
@@ -1479,17 +1497,19 @@ 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) {
@@ -1504,12 +1524,14 @@ 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) {
@@ -1523,12 +1545,13 @@ 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)) {
@@ -1542,7 +1565,7 @@ function rebuild_theme_table($themes) {
}
return $o;
}
}

/**
* @brief Themes admin page
@@ -1560,6 +1583,7 @@ 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');
@@ -1734,13 +1758,14 @@ 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');
@@ -1758,6 +1783,7 @@ 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
@@ -1775,6 +1801,7 @@ 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(
@@ -1806,6 +1833,7 @@ 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
@@ -1825,6 +1853,7 @@ 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');
@@ -1861,12 +1890,14 @@ 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');
@@ -1898,23 +1929,25 @@ 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);
@@ -1933,7 +1966,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"),
@@ -1945,3 +1978,4 @@ function admin_page_features(&$a) {
return $o;
}
}
}

+ 2
- 0
mod/allfriends.php View File

@@ -5,6 +5,7 @@ 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 = '';
@@ -97,3 +98,4 @@ function allfriends_content(&$a) {

return $o;
}
}

+ 3
- 2
mod/amcd.php View File

@@ -1,5 +1,5 @@
<?php
if(! function_exists('amcd_content')) {
function amcd_content(&$a) {
//header("Content-type: text/json");
echo <<< EOT
@@ -46,4 +46,5 @@ echo <<< EOT
}
EOT;
killme();
}
}
}

+ 6
- 5
mod/api.php View File

@@ -1,10 +1,8 @@
<?php

require_once('include/api.php');

if(! function_exists('oauth_get_client')) {
function oauth_get_client($request){


$params = $request->get_parameters();
$token = $params['oauth_token'];

@@ -19,9 +17,10 @@ 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;
@@ -31,9 +30,10 @@ 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,3 +114,4 @@ function api_content(&$a) {
echo api_call($a);
killme();
}
}

+ 17
- 19
mod/apps.php View File

@@ -1,25 +1,23 @@
<?php
if(! function_exists('apps_content')) {
function apps_content(&$a) {
$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');
$privateaddons = get_config('config','private_addons');
if ($privateaddons === "1") {
if((! (local_user()))) {
info( t("You must be logged in to use addons. "));
return;
}
}

if(count($a->apps)==0)
notice( t('No installed applications.') . EOL);
$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,
));


$tpl = get_markup_template("apps.tpl");
return replace_macros($tpl, array(
'$title' => $title,
'$apps' => $a->apps,
));
}
}

+ 2
- 1
mod/attach.php View File

@@ -1,7 +1,7 @@
<?php

require_once('include/security.php');

if(! function_exists('attach_init')) {
function attach_init(&$a) {

if($a->argc != 2) {
@@ -47,3 +47,4 @@ function attach_init(&$a) {
killme();
// NOTREACHED
}
}

+ 24
- 22
mod/babel.php View File

@@ -9,55 +9,56 @@ function visible_lf($s) {
return str_replace("\n",'<br />', $s);
}

if(! function_exists('babel_content')) {
function babel_content(&$a) {

$o .= '<h1>Babel Diagnostic</h1>';

$o .= '<form action="babel" method="post">';
$o .= t('Source (bbcode) text:') . EOL . '<textarea name="text" >' . htmlspecialchars($_REQUEST['text']) .'</textarea>' . EOL;
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';

$o .= '<br /><br />';

$o .= '<form action="babel" method="post">';
$o .= t('Source (Diaspora) text to convert to BBcode:') . EOL . '<textarea name="d2bbtext" >' . htmlspecialchars($_REQUEST['d2bbtext']) .'</textarea>' . EOL;
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';

$o .= '<br /><br />';

if(x($_REQUEST,'text')) {

$text = trim($_REQUEST['text']);
$o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($text) . EOL. EOL;
$o .= "<h2>" . t("Source input: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($text) . EOL. EOL;

$html = bbcode($text);
$o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL;
$o .= htmlspecialchars($html). EOL. EOL;
$o .= "<h2>" . t("bb2html (raw HTML): ") . "</h2>" . EOL. EOL;
$o .= htmlspecialchars($html). EOL. EOL;

//$html = bbcode($text);
$o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL;
$o .= $html. EOL. EOL;
$o .= "<h2>" . t("bb2html: ") . "</h2>" . EOL. EOL;
$o .= $html. EOL. EOL;

$bbcode = html2bbcode($html);
$o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;
$o .= "<h2>" . t("bb2html2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;

$diaspora = bb2diaspora($text);
$o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($diaspora) . EOL. EOL;
$o .= "<h2>" . t("bb2md: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($diaspora) . EOL. EOL;

$html = Markdown($diaspora);
$o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL;
$o .= $html. EOL. EOL;
$o .= "<h2>" . t("bb2md2html: ") . "</h2>" . EOL. EOL;
$o .= $html. EOL. EOL;

$bbcode = diaspora2bb($diaspora);
$o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;
$o .= "<h2>" . t("bb2dia2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;

$bbcode = html2bbcode($html);
$o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;
$o .= "<h2>" . t("bb2md2html2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bbcode) . EOL. EOL;



@@ -66,14 +67,15 @@ function babel_content(&$a) {
if(x($_REQUEST,'d2bbtext')) {

$d2bbtext = trim($_REQUEST['d2bbtext']);
$o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;
$o .= visible_lf($d2bbtext) . EOL. EOL;
$o .= "<h2>" . t("Source input (Diaspora format): ") . "</h2>" . EOL. EOL;
$o .= visible_lf($d2bbtext) . EOL. EOL;


$bb = diaspora2bb($d2bbtext);
$o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bb) . EOL. EOL;
$o .= "<h2>" . t("diaspora2bb: ") . "</h2>" . EOL. EOL;
$o .= visible_lf($bb) . EOL. EOL;
}

return $o;
}
}

+ 4
- 1
mod/bookmarklet.php View File

@@ -1,12 +1,14 @@
<?php

require_once('include/conversation.php');
require_once('include/items.php');

if(! function_exists('bookmarklet_init')) {
function bookmarklet_init(&$a) {
$_GET["mode"] = "minimal";
}
}

if(! function_exists('bookmarklet_content')) {
function bookmarklet_content(&$a) {
if(!local_user()) {
$o = '<h2>'.t('Login').'</h2>';
@@ -44,3 +46,4 @@ function bookmarklet_content(&$a) {

return $o;
}
}

+ 9
- 2
mod/cb.php View File

@@ -4,21 +4,28 @@
* 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;
}
}
}

+ 2
- 0
mod/common.php View File

@@ -5,6 +5,7 @@ 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 = '';
@@ -144,3 +145,4 @@ function common_content(&$a) {

return $o;
}
}

+ 8
- 5
mod/community.php View File

@@ -1,15 +1,14 @@
<?php
if(! function_exists('community_init')) {
function community_init(&$a) {
if(! local_user()) {
unset($_SESSION['theme']);
unset($_SESSION['mobile-theme']);
}


}
}

if(! function_exists('community_content')) {
function community_content(&$a, $update = 0) {

$o = '';
@@ -115,7 +114,9 @@ function community_content(&$a, $update = 0) {

return $o;
}
}

if(! function_exists('community_getitems')) {
function community_getitems($start, $itemspage) {
if (get_config('system','community_page_style') == CP_GLOBAL_COMMUNITY)
return(community_getpublicitems($start, $itemspage));
@@ -140,9 +141,10 @@ function community_getitems($start, $itemspage) {
);

return($r);
}
}

if(! function_exists('community_getpublicitems')) {
function community_getpublicitems($start, $itemspage) {
$r = q("SELECT `item`.`uri`, `item`.*, `item`.`id` AS `item_id`,
`author-name` AS `name`, `owner-avatar` AS `photo`,
@@ -157,3 +159,4 @@ function community_getpublicitems($start, $itemspage) {

return($r);
}
}

+ 3
- 1
mod/contactgroup.php View File

@@ -2,6 +2,7 @@

require_once('include/group.php');

if(! function_exists('contactgroup_content')) {
function contactgroup_content(&$a) {


@@ -47,4 +48,5 @@ function contactgroup_content(&$a) {
}

killme();
}
}
}

+ 30
- 8
mod/contacts.php View File

@@ -7,6 +7,7 @@ require_once('include/Scrape.php');
require_once('mod/proxy.php');
require_once('include/Photo.php');

if(! function_exists('contacts_init')) {
function contacts_init(&$a) {
if(! local_user())
return;
@@ -38,7 +39,7 @@ function contacts_init(&$a) {

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
} else
$networkname = '';

$vcard_widget = replace_macros(get_markup_template("vcard-widget.tpl"),array(
@@ -88,9 +89,10 @@ 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;
@@ -132,10 +134,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())
@@ -215,10 +217,11 @@ 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)
@@ -239,7 +242,9 @@ 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)
@@ -299,7 +304,9 @@ 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",
@@ -308,8 +315,10 @@ 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",
@@ -319,6 +328,9 @@ 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",
@@ -331,14 +343,18 @@ 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;
@@ -799,7 +815,9 @@ function contacts_content(&$a) {

return $o;
}
}

if(! function_exists('contacts_tab')) {
function contacts_tab($a, $contact_id, $active_tab) {
// tabs
$tabs = array(
@@ -873,7 +891,9 @@ 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));
@@ -901,7 +921,9 @@ function contact_posts($a, $contact_id) {

return $o;
}
}

if(! function_exists('_contact_detail_for_template')) {
function _contact_detail_for_template($rr){

$community = '';
@@ -952,5 +974,5 @@ function _contact_detail_for_template($rr){
'url' => $url,
'network' => network_to_name($rr['network'], $rr['url']),
);
}
}

+ 24
- 24
mod/content.php View File

@@ -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;
}
}

+ 2
- 0
mod/credits.php View File

@@ -5,6 +5,7 @@
* 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');
@@ -18,3 +19,4 @@ function credits_content (&$a) {
'$names' => $arr,
));
}
}

+ 6
- 4
mod/crepair.php View File

@@ -2,6 +2,7 @@
require_once("include/contact_selectors.php");
require_once("mod/contacts.php");

if(! function_exists('crepair_init')) {
function crepair_init(&$a) {
if(! local_user())
return;
@@ -28,8 +29,9 @@ 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;
@@ -91,9 +93,9 @@ function crepair_post(&$a) {

return;
}
}



if(! function_exists('crepair_content')) {
function crepair_content(&$a) {

if(! local_user()) {
@@ -180,5 +182,5 @@ function crepair_content(&$a) {
));

return $o;
}
}

+ 6
- 4
mod/delegate.php View File

@@ -1,11 +1,13 @@
<?php
require_once('mod/settings.php');

if(! function_exists('delegate_init')) {
function delegate_init(&$a) {
return settings_init($a);
}
}

if(! function_exists('delegate_content')) {
function delegate_content(&$a) {

if(! local_user()) {
@@ -90,12 +92,12 @@ function delegate_content(&$a) {

// find every contact who might be a candidate for delegation

$r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
$r = q("select nurl from contact where substring_index(contact.nurl,'/',3) = '%s'
and contact.uid = %d and contact.self = 0 and network = '%s' ",
dbesc(normalise_link($a->get_baseurl())),
intval(local_user()),
dbesc(NETWORK_DFRN)
);
);

if(! count($r)) {
notice( t('No potential page delegates located.') . EOL);
@@ -144,5 +146,5 @@ function delegate_content(&$a) {

return $o;

}
}

+ 2
- 1
mod/dfrn_confirm.php View File

@@ -16,6 +16,7 @@

require_once('include/enotify.php');

if(! function_exists('dfrn_confirm_post')) {
function dfrn_confirm_post(&$a,$handsfree = null) {

if(is_array($handsfree)) {
@@ -801,5 +802,5 @@ function dfrn_confirm_post(&$a,$handsfree = null) {

goaway(z_root());
// NOTREACHED
}
}

+ 4
- 2
mod/dfrn_notify.php View File

@@ -5,6 +5,7 @@ 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'])) : '');
@@ -213,8 +214,9 @@ function dfrn_notify_post(&$a) {

// NOTREACHED
}
}

if(! function_exists('dfrn_notify_content')) {
function dfrn_notify_content(&$a) {

if(x($_GET,'dfrn_id')) {
@@ -338,5 +340,5 @@ function dfrn_notify_content(&$a) {

killme();
}
}
}

+ 8
- 5
mod/dfrn_poll.php View File

@@ -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,7 +377,9 @@ 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'] : '');
@@ -562,3 +564,4 @@ function dfrn_poll_content(&$a) {
}
}
}
}

+ 10
- 9
mod/directory.php View File

@@ -1,5 +1,5 @@
<?php
if(! function_exists('directory_init')) {
function directory_init(&$a) {
$a->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 .= '<br />' . t('Age: ') . $years ;
// $details .= '<br />' . t('Age: ') . $years ;
// }
// if(strlen($rr['gender']))
// $details .= '<br />' . 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,3 +217,4 @@ function directory_content(&$a) {

return $o;
}
}

+ 4
- 2
mod/dirfind.php View File

@@ -5,6 +5,7 @@ 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()) {
@@ -19,9 +20,9 @@ function dirfind_init(&$a) {

$a->page['aside'] .= follow_widget();
}
}



if(! function_exists('dirfind_content')) {
function dirfind_content(&$a, $prefix = "") {

$community = false;
@@ -235,3 +236,4 @@ function dirfind_content(&$a, $prefix = "") {

return $o;
}
}

+ 6
- 3
mod/display.php View File

@@ -1,5 +1,5 @@
<?php
if(! function_exists('display_init')) {
function display_init(&$a) {

if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@@ -85,9 +85,10 @@ function display_init(&$a) {
}

profile_load($a, $nick, 0, $profiledata);
}
}

if(! function_exists('display_fetchauthor')) {
function display_fetchauthor($a, $item) {

$profiledata = array();
@@ -220,7 +221,9 @@ function display_fetchauthor($a, $item) {

return($profiledata);
}
}

if(! function_exists('display_content')) {
function display_content(&$a, $update = 0) {

if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@@ -522,4 +525,4 @@ function display_content(&$a, $update = 0) {

return $o;
}
}

+ 2
- 3
mod/editpost.php View File

@@ -2,6 +2,7 @@

require_once('include/acl_selectors.php');

if(! function_exists('editpost_content')) {
function editpost_content(&$a) {

$o = '';
@@ -150,7 +151,5 @@ function editpost_content(&$a) {
));

return $o;

}


}

+ 4
- 2
mod/events.php View File

@@ -5,6 +5,7 @@ require_once('include/datetime.php');
require_once('include/event.php');
require_once('include/items.php');

if(! function_exists('events_post')) {
function events_post(&$a) {

logger('post: ' . print_r($_REQUEST,true));
@@ -156,9 +157,9 @@ function events_post(&$a) {

goaway($_SESSION['return_url']);
}
}



if(! function_exists('events_content')) {
function events_content(&$a) {

if(! local_user()) {
@@ -578,3 +579,4 @@ function events_content(&$a) {
return $o;
}
}
}

+ 2
- 1
mod/fbrowser.php View File

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

if (!local_user())
@@ -141,5 +142,5 @@ function fbrowser_content($a){
killme();
}

}
}

+ 3
- 2
mod/filer.php View File

@@ -4,7 +4,7 @@ require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');

if(! function_exists('filer_content')) {
function filer_content(&$a) {

if(! local_user()) {
@@ -30,8 +30,9 @@ function filer_content(&$a) {
'$field' => array('term', t("Save to Folder:"), '', '', $filetags, t('- select -')),
'$submit' => t('Save'),
));
echo $o;
}
killme();
}
}

+ 2
- 0
mod/filerm.php View File

@@ -1,5 +1,6 @@
<?php

if(! function_exists('filerm_content')) {
function filerm_content(&$a) {

if(! local_user()) {
@@ -25,3 +26,4 @@ function filerm_content(&$a) {

killme();
}
}

+ 4
- 0
mod/follow.php View File

@@ -5,6 +5,7 @@ require_once('include/follow.php');
require_once('include/Contact.php');
require_once('include/contact_selectors.php');

if(! function_exists('follow_content')) {
function follow_content(&$a) {

if(! local_user()) {
@@ -148,7 +149,9 @@ function follow_content(&$a) {

return $o;
}
}

if(! function_exists('follow_post')) {
function follow_post(&$a) {

if(! local_user()) {
@@ -185,3 +188,4 @@ function follow_post(&$a) {
goaway($return_url);
// NOTREACHED
}
}

+ 6
- 5
mod/friendica.php View File

@@ -1,5 +1,6 @@
<?php

if(! function_exists('friendica_init')) {
function friendica_init(&$a) {
if ($a->argv[1]=="json"){
$register_policy = Array('REGISTER_CLOSED', 'REGISTER_APPROVE', 'REGISTER_OPEN');
@@ -56,9 +57,9 @@ function friendica_init(&$a) {
killme();
}
}
}



if(! function_exists('friendica_content')) {
function friendica_content(&$a) {

$o = '';
@@ -70,7 +71,7 @@ function friendica_content(&$a) {
$o .= t('This is Friendica, version') . ' ' . FRIENDICA_VERSION . ' ';
$o .= t('running at web location') . ' ' . z_root() . '</p><p>';

$o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';
$o .= t('Please visit <a href="http://friendica.com">Friendica.com</a> to learn more about the Friendica project.') . '</p><p>';

$o .= t('Bug reports and issues: please visit') . ' ' . '<a href="https://github.com/friendica/friendica/issues?state=open">'.t('the bugtracker at github').'</a></p><p>';
$o .= t('Suggestions, praise, donations, etc. - please email "Info" at Friendica - dot com') . '</p>';
@@ -102,8 +103,8 @@ function friendica_content(&$a) {
else
$o .= '<p>' . t('No installed plugins/addons/apps') . '</p>';

call_hooks('about_hook', $o);
call_hooks('about_hook', $o);

return $o;
}
}

+ 10
- 9
mod/fsuggest.php View File

@@ -1,6 +1,6 @@
<?php

if(! function_exists('fsuggest_post')) {
function fsuggest_post(&$a) {

if(! local_user()) {
@@ -39,11 +39,11 @@ function fsuggest_post(&$a) {
VALUES ( %d, %d, '%s','%s','%s','%s','%s','%s')",
intval(local_user()),
intval($contact_id),
dbesc($r[0]['name']),
dbesc($r[0]['url']),
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc($r[0]['name']),
dbesc($r[0]['url']),
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc(datetime_convert())
);
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
@@ -65,11 +65,11 @@ function fsuggest_post(&$a) {

}

}
}


if(! function_exists('fsuggest_content')) {
function fsuggest_content(&$a) {

require_once('include/acl_selectors.php');
@@ -100,7 +100,7 @@ function fsuggest_content(&$a) {

$o .= '<form id="fsuggest-form" action="fsuggest/' . $contact_id . '" method="post" >';

$o .= contact_selector('suggest','suggest-select', false,
$o .= contact_selector('suggest','suggest-select', false,
array('size' => 4, 'exclude' => $contact_id, 'networks' => 'DFRN_ONLY', 'single' => true));


@@ -109,3 +109,4 @@ function fsuggest_content(&$a) {

return $o;
}
}

+ 8
- 3
mod/group.php View File

@@ -1,18 +1,21 @@
<?php

if(! function_exists('validate_members')) {
function validate_members(&$item) {
$item = intval($item);
}
}

if(! function_exists('group_init')) {
function group_init(&$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));
}
}
}



if(! function_exists('group_post')) {
function group_post(&$a) {

if(! local_user()) {
@@ -64,7 +67,9 @@ function group_post(&$a) {
}
return;
}
}

if(! function_exists('group_content')) {
function group_content(&$a) {
$change = false;

@@ -229,5 +234,5 @@ function group_content(&$a) {
}

return replace_macros($tpl, $context);
}
}

+ 5
- 5
mod/hcard.php View File

@@ -1,5 +1,6 @@
<?php

if(! function_exists('hcard_init')) {
function hcard_init(&$a) {

$blocked = (((get_config('system','block_public')) && (! local_user()) && (! remote_user())) ? true : false);
@@ -15,7 +16,7 @@ function hcard_init(&$a) {
$profile = 0;
if((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) {
$which = $a->user['nickname'];
$profile = $a->argv[1];
$profile = $a->argv[1];
}

profile_load($a,$which,$profile);
@@ -23,7 +24,7 @@ function hcard_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')) {
$delegate = ((strstr($a->profile['openid'],'://')) ? $a->profile['openid'] : 'http://' . $a->profile['openid']);
@@ -42,10 +43,9 @@ function hcard_init(&$a) {
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $a->get_hostname() . (($a->path) ? '/' . $a->path : ''));
$a->page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $a->get_baseurl() . '/xrd/?uri=' . $uri . '" />' . "\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'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".$a->get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n";

}
}

+ 2
- 1
mod/help.php View File

@@ -18,6 +18,7 @@ if (!function_exists('load_doc_file')) {

}

if(! function_exists('help_content')) {
function help_content(&$a) {

nav_set_selected('help');
@@ -98,5 +99,5 @@ function help_content(&$a) {
}
</style>".$html;
return $html;
}
}

+ 2
- 1
mod/hostxrd.php View File

@@ -2,6 +2,7 @@

require_once('include/crypto.php');

if(! function_exists('hostxrd_init')) {
function hostxrd_init(&$a) {
header('Access-Control-Allow-Origin: *');
header("Content-type: text/xml");
@@ -27,5 +28,5 @@ function hostxrd_init(&$a) {
));
session_write_close();
exit();
}
}

+ 2
- 1
mod/ignored.php View File

@@ -1,6 +1,6 @@
<?php

if(! function_exists('ignored_init')) {
function ignored_init(&$a) {