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.
This commit is contained in:
Andrej Stieben 2016-02-05 21:52:39 +01:00
commit db949bb802
123 changed files with 768 additions and 471 deletions

View file

@ -1,6 +1,7 @@
<?php
function uexport_init(&$a){
if(! function_exists('uexport_init')) {
function uexport_init(&$a) {
if(! local_user())
killme();
@ -55,8 +56,10 @@ function uexport_init(&$a){
));
*/
}
}
function uexport_content(&$a){
if(! function_exists('uexport_content')) {
function uexport_content(&$a) {
if ($a->argc > 1) {
header("Content-type: application/json");
@ -86,9 +89,10 @@ function uexport_content(&$a){
'$options' => $options
));
}
}
if(! function_exists('_uexport_multirow')) {
function _uexport_multirow($query) {
$result = array();
$r = q($query);
@ -103,7 +107,9 @@ function _uexport_multirow($query) {
}
return $result;
}
}
if(! function_exists('_uexport_row')) {
function _uexport_row($query) {
$result = array();
$r = q($query);
@ -115,9 +121,10 @@ function _uexport_row($query) {
}
return $result;
}
}
function uexport_account($a){
if(! function_exists('uexport_account')) {
function uexport_account($a) {
$user = _uexport_row(
sprintf( "SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", intval(local_user()) )
@ -153,9 +160,9 @@ function uexport_account($a){
'version' => FRIENDICA_VERSION,
'schema' => DB_UPDATE_VERSION,
'baseurl' => $a->get_baseurl(),
'user' => $user,
'contact' => $contact,
'profile' => $profile,
'user' => $user,
'contact' => $contact,
'profile' => $profile,
'photo' => $photo,
'pconfig' => $pconfig,
'group' => $group,
@ -164,14 +171,15 @@ function uexport_account($a){
//echo "<pre>"; var_dump(json_encode($output)); killme();
echo json_encode($output);
}
}
/**
* echoes account data and items as separated json, one per line
*/
if(! function_exists('uexport_all')) {
function uexport_all(&$a) {
uexport_account($a);
echo "\n";
@ -199,5 +207,5 @@ function uexport_all(&$a) {
$output = array('item' => $r);
echo json_encode($output)."\n";
}
}
}