Merge pull request #2319 from stieben/develop

Added the possibility for themes to override core module functions
This commit is contained in:
fabrixxm 2016-02-07 09:52:20 +01:00
commit 9330a6994c
127 changed files with 886 additions and 559 deletions

View File

@ -1,5 +1,7 @@
Friendica Addon/Plugin development
==========================
==============
* [Home](help)
Please see the sample addon 'randplace' for a working example of using some of these features.
Addons work by intercepting event hooks - which must be registered.
@ -16,12 +18,12 @@ Future extensions may provide for "setup" amd "remove".
Plugins should contain a comment block with the four following parameters:
/*
* Name: My Great Plugin
* Description: This is what my plugin does. It's really cool
* Version: 1.0
* Author: John Q. Public <john@myfriendicasite.com>
*/
/*
* Name: My Great Plugin
* Description: This is what my plugin does. It's really cool.
* Version: 1.0
* Author: John Q. Public <john@myfriendicasite.com>
*/
Register your plugin hooks during installation.
@ -45,7 +47,7 @@ Your hook callback functions will be called with at least one and possibly two a
If you wish to make changes to the calling data, you must declare them as reference variables (with '&') during function declaration.
###$a
#### $a
$a is the Friendica 'App' class.
It contains a wealth of information about the current state of Friendica:
@ -56,13 +58,13 @@ It contains a wealth of information about the current state of Friendica:
It is recommeded you call this '$a' to match its usage elsewhere.
###$b
#### $b
$b can be called anything you like.
This is information specific to the hook currently being processed, and generally contains information that is being immediately processed or acted on that you can use, display, or alter.
Remember to declare it with '&' if you wish to alter it.
Modules
--------
---
Plugins/addons may also act as "modules" and intercept all page requests for a given URL path.
In order for a plugin to act as a module it needs to define a function "plugin_name_module()" which takes no arguments and needs not do anything.
@ -72,15 +74,15 @@ These are parsed into an array $a->argv, with a corresponding $a->argc indicatin
So http://my.web.site/plugin/arg1/arg2 would look for a module named "plugin" and pass its module functions the $a App structure (which is available to many components).
This will include:
$a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
$a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Your module functions will often contain the function plugin_name_content(&$a), which defines and returns the page body content.
They may also contain plugin_name_post(&$a) which is called before the _content function and typically handles the results of POST forms.
You may also have plugin_name_init(&$a) which is called very early on and often does module initialisation.
Templates
----------
---
If your plugin needs some template, you can use the Friendica template system.
Friendica uses [smarty3](http://www.smarty.net/) as a template engine.
@ -104,140 +106,140 @@ See also the wiki page [Quick Template Guide](https://github.com/friendica/frien
Current hooks
-------------
###'authenticate'
### 'authenticate'
'authenticate' is called when a user attempts to login.
$b is an array containing:
'username' => the supplied username
'password' => the supplied password
'username' => the supplied username
'password' => the supplied password
'authenticated' => set this to non-zero to authenticate the user.
'user_record' => successful authentication must also return a valid user record from the database
###'logged_in'
### 'logged_in'
'logged_in' is called after a user has successfully logged in.
$b contains the $a->user array.
###'display_item'
### 'display_item'
'display_item' is called when formatting a post for display.
$b is an array:
'item' => The item (array) details pulled from the database
'output' => the (string) HTML representation of this item prior to adding it to the page
###'post_local'
### 'post_local'
* called when a status post or comment is entered on the local system
* $b is the item array of the information to be stored in the database
* Please note: body contents are bbcode - not HTML
###'post_local_end'
### 'post_local_end'
* called when a local status post or comment has been stored on the local system
* $b is the item array of the information which has just been stored in the database
* Please note: body contents are bbcode - not HTML
###'post_remote'
### 'post_remote'
* called when receiving a post from another source. This may also be used to post local activity or system generated messages.
* $b is the item array of information to be stored in the database and the item body is bbcode.
###'settings_form'
### 'settings_form'
* called when generating the HTML for the user Settings page
* $b is the (string) HTML of the settings page before the final '</form>' tag.
###'settings_post'
### 'settings_post'
* called when the Settings pages are submitted
* $b is the $_POST array
###'plugin_settings'
### 'plugin_settings'
* called when generating the HTML for the addon settings page
* $b is the (string) HTML of the addon settings page before the final '</form>' tag.
###'plugin_settings_post'
### 'plugin_settings_post'
* called when the Addon Settings pages are submitted
* $b is the $_POST array
###'profile_post'
### 'profile_post'
* called when posting a profile page
* $b is the $_POST array
###'profile_edit'
### 'profile_edit'
'profile_edit' is called prior to output of profile edit page.
$b is an array containing:
'profile' => profile (array) record from the database
'entry' => the (string) HTML of the generated entry
###'profile_advanced'
### 'profile_advanced'
* called when the HTML is generated for the 'Advanced profile', corresponding to the 'Profile' tab within a person's profile page
* $b is the (string) HTML representation of the generated profile
* The profile array details are in $a->profile.
###'directory_item'
### 'directory_item'
'directory_item' is called from the Directory page when formatting an item for display.
$b is an array:
'contact' => contact (array) record for the person from the database
'entry' => the (string) HTML of the generated entry
###'profile_sidebar_enter'
### 'profile_sidebar_enter'
* called prior to generating the sidebar "short" profile for a page
* $b is the person's profile array
###'profile_sidebar'
### 'profile_sidebar'
'profile_sidebar is called when generating the sidebar "short" profile for a page.
$b is an array:
'profile' => profile (array) record for the person from the database
'entry' => the (string) HTML of the generated entry
###'contact_block_end'
### 'contact_block_end'
is called when formatting the block of contacts/friends on a profile sidebar has completed.
$b is an array:
'contacts' => array of contacts
'output' => the (string) generated HTML of the contact block
###'bbcode'
### 'bbcode'
* called during conversion of bbcode to html
* $b is a string converted text
###'html2bbcode'
### 'html2bbcode'
* called during conversion of html to bbcode (e.g. remote message posting)
* $b is a string converted text
###'page_header'
### 'page_header'
* called after building the page navigation section
* $b is a string HTML of nav region
###'personal_xrd'
### 'personal_xrd'
'personal_xrd' is called prior to output of personal XRD file.
$b is an array:
'user' => the user record for the person
'xml' => the complete XML to be output
###'home_content'
### 'home_content'
* called prior to output home page content, shown to unlogged users
* $b is (string) HTML of section region
###'contact_edit'
### 'contact_edit'
is called when editing contact details on an individual from the Contacts page.
$b is an array:
'contact' => contact record (array) of target contact
'output' => the (string) generated HTML of the contact edit page
###'contact_edit_post'
### 'contact_edit_post'
* called when posting the contact edit page.
* $b is the $_POST array
###'init_1'
### 'init_1'
* called just after DB has been opened and before session start
* $b is not used or passed
###'page_end'
### 'page_end'
* called after HTML content functions have completed
* $b is (string) HTML of content div
###'avatar_lookup'
### 'avatar_lookup'
'avatar_lookup' is called when looking up the avatar.
$b is an array:
@ -245,11 +247,11 @@ $b is an array:
'email' => email to look up the avatar for
'url' => the (string) generated URL of the avatar
###'emailer_send_prepare'
### 'emailer_send_prepare'
'emailer_send_prepare' called from Emailer::send() before building the mime message.
$b is an array, params to Emailer::send()
'fromName' => name of the sender
'fromName' => name of the sender
'fromEmail' => email fo the sender
'replyTo' => replyTo address to direct responses
'toEmail' => destination email address
@ -258,20 +260,20 @@ $b is an array, params to Emailer::send()
'textVersion' => text only version of the message
'additionalMailHeader' => additions to the smtp mail header
###'emailer_send'
### 'emailer_send'
is called before calling PHP's mail().
$b is an array, params to mail()
'to'
'subject'
'to'
'subject'
'body'
'headers'
###'nav_info'
### 'nav_info'
is called after the navigational menu is build in include/nav.php.
$b is an array containing $nav from nav.php.
###'template_vars'
### 'template_vars'
is called before vars are passed to the template engine to render the page.
The registered function can add,change or remove variables passed to template.
$b is an array with:
@ -463,4 +465,3 @@ mod/cb.php: call_hooks('cb_afterpost');
mod/cb.php: call_hooks('cb_content', $o);
mod/directory.php: call_hooks('directory_item', $arr);

View File

@ -1,11 +1,12 @@
**Friendica Addon/Plugin-Entwicklung**
Friendica Addon/Plugin-Entwicklung
==============
* [Zur Startseite der Hilfe](help)
Bitte schau dir das Beispiel-Addon "randplace" für ein funktionierendes Beispiel für manche der hier aufgeführten Funktionen an.
Das Facebook-Addon bietet ein Beispiel dafür, die "addon"- und "module"-Funktion gemeinsam zu integrieren.
Addons arbeiten, indem sie Event Hooks abfangen. Module arbeiten, indem bestimmte Seitenanfragen (durch den URL-Pfad) abgefangen werden
Addons arbeiten, indem sie Event Hooks abfangen.
Module arbeiten, indem bestimmte Seitenanfragen (durch den URL-Pfad) abgefangen werden.
Plugin-Namen können keine Leerstellen oder andere Interpunktionen enthalten und werden als Datei- und Funktionsnamen genutzt.
Du kannst einen lesbaren Namen im Kommentarblock eintragen.
@ -16,12 +17,12 @@ Zukünftige Extensions werden möglicherweise "Setup" und "Entfernen" anbieten.
Plugins sollten einen Kommentarblock mit den folgenden vier Parametern enthalten:
/*
* Name: My Great Plugin
* Description: This is what my plugin does. It's really cool
* Version: 1.0
* Author: John Q. Public <john@myfriendicasite.com>
*/
/*
* Name: My Great Plugin
* Description: This is what my plugin does. It's really cool.
* Version: 1.0
* Author: John Q. Public <john@myfriendicasite.com>
*/
Registriere deine Plugin-Hooks während der Installation.
@ -34,6 +35,9 @@ Das *sollte* "addon/plugin_name/plugin_name.php' sein.
$function ist ein String und der Name der Funktion, die ausgeführt wird, wenn der Hook aufgerufen wird.
Argumente
---
Deine Hook-Callback-Funktion wird mit mindestens einem und bis zu zwei Argumenten aufgerufen
function myhook_function(&$a, &$b) {
@ -50,24 +54,26 @@ Diese Information ist speziell auf den Hook bezogen, der aktuell bearbeitet wird
Achte darauf, diese mit "&" zu deklarieren, wenn du sie bearbeiten willst.
**Module**
Module
---
Plugins/Addons können auch als "Module" agieren und alle Seitenanfragen für eine bestimte URL abfangen.
Um ein Plugin als Modul zu nutzen, ist es nötig, die Funktion "plugin_name_module()" zu definieren, die keine Argumente benötigt und nichts weiter machen muss.
Wenn diese Funktion existiert, wirst du nun alle Seitenanfragen für "http://my.web.site/plugin_name" erhalten - mit allen URL-Komponenten als zusätzliche Argumente.
Wenn diese Funktion existiert, wirst du nun alle Seitenanfragen für "http://example.com/plugin_name" erhalten - mit allen URL-Komponenten als zusätzliche Argumente.
Diese werden in ein Array $a->argv geparst und stimmen mit $a->argc überein, wobei sie die Anzahl der URL-Komponenten abbilden.
So würde http://my.web.site/plugin/arg1/arg2 nach einem Modul "plugin" suchen und seiner Modulfunktion die $a-App-Strukur übergeben (dies ist für viele Komponenten verfügbar). Das umfasst:
So würde http://example.com/plugin/arg1/arg2 nach einem Modul "plugin" suchen und seiner Modulfunktion die $a-App-Strukur übergeben (dies ist für viele Komponenten verfügbar). Das umfasst:
$a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
$a->argc = 3
$a->argv = array(0 => 'plugin', 1 => 'arg1', 2 => 'arg2');
Deine Modulfunktionen umfassen oft die Funktion plugin_name_content(&$a), welche den Seiteninhalt definiert und zurückgibt.
Sie können auch plugin_name_post(&$a) umfassen, welches vor der content-Funktion aufgerufen wird und normalerweise die Resultate der POST-Formulare handhabt.
Du kannst ebenso plugin_name_init(&$a) nutzen, was oft frühzeitig aufgerufen wird und das Modul initialisert.
**Derzeitige Hooks:**
Derzeitige Hooks
---
**'authenticate'** - wird aufgerufen, wenn sich der User einloggt.
$b ist ein Array
@ -180,6 +186,9 @@ Du kannst ebenso plugin_name_init(&$a) nutzen, was oft frühzeitig aufgerufen wi
- wird aufgerufen nachdem in include/nav,php der Inhalt des Navigations Menüs erzeugt wurde.
- $b ist ein Array, das $nav wiederspiegelt.
Komplette Liste der Hook-Callbacks
---
Eine komplette Liste aller Hook-Callbacks mit den zugehörigen Dateien (am 14-Feb-2012 generiert): Bitte schau in die Quellcodes für Details zu Hooks, die oben nicht dokumentiert sind.
boot.php: call_hooks('login_hook',$o);
@ -359,4 +368,3 @@ mod/cb.php: call_hooks('cb_afterpost');
mod/cb.php: call_hooks('cb_content', $o);
mod/directory.php: call_hooks('directory_item', $arr);

View File

@ -59,7 +59,19 @@ The same rule applies to the JavaScript files found in
they will be overwritten by files in
/view/theme/**your-theme-name**/js.
/view/theme/**your-theme-name**/js
### Modules
You have the freedom to override core modules found in
/mod
They will be overwritten by files in
/view/theme/**your-theme-name**/mod
Be aware that you can break things easily here if you don't know what you do. Also notice that you can override parts of the module functions not defined in your theme module will be loaded from the core module.
## Expand an existing Theme

View File

@ -233,7 +233,16 @@ if(strlen($a->module)) {
}
/**
* If not, next look for a 'standard' program module in the 'mod' directory
* If not, next look for module overrides by the theme
*/
if((! $a->module_loaded) && (file_exists("view/theme/" . current_theme() . "/mod/{$a->module}.php"))) {
include_once("view/theme/" . current_theme() . "/mod/{$a->module}.php");
// We will not set module_loaded to true to allow for partial overrides.
}
/**
* Finally, look for a 'standard' program module in the 'mod' directory
*/
if((! $a->module_loaded) && (file_exists("mod/{$a->module}.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;
}
}

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) {
}
}
}
}

View File

@ -3,8 +3,8 @@
require_once("include/acl_selectors.php");
if(! function_exists('acl_init')) {
function acl_init(&$a){
acl_lookup($a);
}
}

View File

@ -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
@ -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,7 +1087,7 @@ function admin_page_dbsync(&$a) {
}
return $o;
}
}
/**
@ -1081,6 +1095,7 @@ function admin_page_dbsync(&$a) {
*
* @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){
/*
@ -1484,12 +1502,14 @@ function admin_page_plugins(&$a){
'$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,6 +1929,7 @@ function admin_page_features_post(&$a) {
goaway($a->get_baseurl(true) . '/admin/features' );
return; // NOTREACHED
}
}
/**
* @brief Subpage for global additional feature management
@ -1913,6 +1945,7 @@ function admin_page_features_post(&$a) {
* @param App $a
* @return string
*/
if(! function_exists('admin_page_features')) {
function admin_page_features(&$a) {
if((argc() > 1) && (argv(1) === 'features')) {
@ -1945,3 +1978,4 @@ function admin_page_features(&$a) {
return $o;
}
}
}

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

View File

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

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();
}
}

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;};
$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,
));
}
$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,
));
}

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

View File

@ -9,6 +9,7 @@ function visible_lf($s) {
return str_replace("\n",'<br />', $s);
}
if(! function_exists('babel_content')) {
function babel_content(&$a) {
$o .= '<h1>Babel Diagnostic</h1>';
@ -77,3 +78,4 @@ function babel_content(&$a) {
return $o;
}
}

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

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

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

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

View File

@ -2,6 +2,7 @@
require_once('include/group.php');
if(! function_exists('contactgroup_content')) {
function contactgroup_content(&$a) {
@ -48,3 +49,4 @@ function contactgroup_content(&$a) {
killme();
}
}

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;
@ -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']),
);
}
}

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');
@ -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');
@ -897,5 +897,5 @@ function render_content(&$a, $items, $mode, $update, $preview = false) {
return $threads;
}
}

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,
));
}
}

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

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()) {
@ -144,5 +146,5 @@ function delegate_content(&$a) {
return $o;
}
}

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

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();
}
}
}

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) {
@ -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'] : '');
@ -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) {
}
}
}
}

View File

@ -1,5 +1,5 @@
<?php
if(! function_exists('directory_init')) {
function directory_init(&$a) {
$a->set_pager_itemspage(60);
@ -16,17 +16,17 @@ 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;
@ -217,3 +217,4 @@ function directory_content(&$a) {
return $o;
}
}

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

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

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

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

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();
}
}
}

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()) {
@ -35,3 +35,4 @@ function filer_content(&$a) {
}
killme();
}
}

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();
}
}

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

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 = '';
@ -105,5 +106,5 @@ function friendica_content(&$a) {
call_hooks('about_hook', $o);
return $o;
}
}

View File

@ -1,6 +1,6 @@
<?php
if(! function_exists('fsuggest_post')) {
function fsuggest_post(&$a) {
if(! local_user()) {
@ -65,11 +65,11 @@ function fsuggest_post(&$a) {
}
}
}
if(! function_exists('fsuggest_content')) {
function fsuggest_content(&$a) {
require_once('include/acl_selectors.php');
@ -109,3 +109,4 @@ function fsuggest_content(&$a) {
return $o;
}
}

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

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);
@ -46,6 +47,5 @@ function hcard_init(&$a) {
$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";
}
}

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

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();
}
}

View File

@ -1,6 +1,6 @@
<?php
if(! function_exists('ignored_init')) {
function ignored_init(&$a) {
$ignored = 0;
@ -43,3 +43,4 @@ function ignored_init(&$a) {
echo json_encode($ignored);
killme();
}
}

View File

@ -3,7 +3,7 @@ require_once "include/Photo.php";
$install_wizard_pass=1;
if(! function_exists('install_init')) {
function install_init(&$a){
// $baseurl/install/testrwrite to test if rewite in .htaccess is working
@ -22,9 +22,10 @@ function install_init(&$a){
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;
@ -112,14 +113,18 @@ 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;
@ -304,6 +309,7 @@ function install_content(&$a) {
}
}
}
/**
* checks : array passed to template
@ -312,7 +318,8 @@ function install_content(&$a) {
* required : boolean
* help : string optional
*/
function check_add(&$checks, $title, $status, $required, $help){
if(! function_exists('check_add')) {
function check_add(&$checks, $title, $status, $required, $help) {
$checks[] = array(
'title' => $title,
'status' => $status,
@ -320,7 +327,9 @@ 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)){
@ -370,9 +379,10 @@ 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 = '';
@ -392,10 +402,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, "");
@ -457,8 +467,9 @@ 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 = "";
@ -473,9 +484,10 @@ 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 = "";
@ -489,9 +501,10 @@ 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;
@ -511,7 +524,9 @@ 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;
@ -528,16 +543,18 @@ 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 .= "<textarea rows=\"24\" cols=\"80\" >$data</textarea>";
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]=="*"))){
@ -546,8 +563,9 @@ function load_database_rem($v, $i){
return $v."\n".$i;
}
}
}
if(! function_exists('load_database')) {
function load_database($db) {
require_once("include/dbstructure.php");
@ -567,7 +585,9 @@ function load_database($db) {
return $errors;
}
}
if(! function_exists('what_next')) {
function what_next() {
$a = get_app();
$baseurl = $a->get_baseurl();
@ -579,5 +599,4 @@ function what_next() {
.t("Go to your new Friendica node <a href='$baseurl/register'>registration page</a> 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.")
."</p>";
}
}

View File

@ -9,6 +9,7 @@
require_once('include/email.php');
if(! function_exists('invite_post')) {
function invite_post(&$a) {
if(! local_user()) {
@ -93,8 +94,9 @@ 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()) {
@ -142,3 +144,4 @@ function invite_content(&$a) {
return $o;
}
}

View File

@ -25,6 +25,7 @@ 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')))
@ -1017,7 +1018,9 @@ 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
@ -1037,9 +1040,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()))
@ -1058,6 +1061,7 @@ function item_content(&$a) {
}
return $o;
}
}
/**
* This function removes the tag $tag from the text $body and replaces it with
@ -1071,6 +1075,7 @@ 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");
@ -1245,8 +1250,9 @@ 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
@ -1284,3 +1290,4 @@ function store_diaspora_comment_sig($datarray, $author, $uprvkey, $parent_item,
return;
}
}

View File

@ -5,6 +5,7 @@ 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;
@ -28,11 +29,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) {
@ -45,4 +46,4 @@ function like_content_return($baseurl, $return_path) {
killme();
}
}

View File

@ -2,7 +2,7 @@
require_once('include/datetime.php');
if(! function_exists('localtime_post')) {
function localtime_post(&$a) {
$t = $_REQUEST['time'];
@ -13,9 +13,10 @@ 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)
@ -45,5 +46,5 @@ function localtime_content(&$a) {
$o .= '<input type="submit" name="submit" value="' . t('Submit') . '" /></form>';
return $o;
}
}

View File

@ -1,6 +1,6 @@
<?php
if(! function_exists('lockview_content')) {
function lockview_content(&$a) {
$type = (($a->argc > 1) ? $a->argv[1] : 0);
@ -86,5 +86,5 @@ function lockview_content(&$a) {
echo $o . implode(', ', $l);
killme();
}
}

View File

@ -1,5 +1,5 @@
<?php
if(! function_exists('login_content')) {
function login_content(&$a) {
if(x($_SESSION,'theme'))
unset($_SESSION['theme']);
@ -9,5 +9,5 @@ function login_content(&$a) {
if(local_user())
goaway(z_root());
return login(($a->config['register_policy'] == REGISTER_CLOSED) ? false : true);
}
}

View File

@ -4,6 +4,7 @@ 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']));
@ -74,10 +75,10 @@ function lostpass_post(&$a) {
'body' => $body));
goaway(z_root());
}
}
if(! function_exists('lostpass_content')) {
function lostpass_content(&$a) {
@ -164,5 +165,5 @@ function lostpass_content(&$a) {
return $o;
}
}
}

View File

@ -1,7 +1,8 @@
<?php
if(! function_exists('maintenance_content')) {
function maintenance_content(&$a) {
return replace_macros(get_markup_template('maintenance.tpl'), array(
'$sysdown' => t('System down for maintenance')
));
}
}

View File

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

View File

@ -13,6 +13,7 @@ require_once('mod/proxy.php');
* @param App &$a
* @return void|string
*/
if(! function_exists('match_content')) {
function match_content(&$a) {
$o = '';
@ -109,3 +110,4 @@ function match_content(&$a) {
return $o;
}
}

View File

@ -3,6 +3,7 @@
require_once('include/acl_selectors.php');
require_once('include/message.php');
if(! function_exists('message_init')) {
function message_init(&$a) {
$tabs = '';
@ -36,9 +37,10 @@ function message_init(&$a) {
'$baseurl' => $a->get_baseurl(true),
'$base' => $base
));
}
}
if(! function_exists('message_post')) {
function message_post(&$a) {
if(! local_user()) {
@ -91,7 +93,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'
@ -171,7 +173,7 @@ function item_redir_and_replace_images($body, $images, $cid) {
}}
if(! function_exists('message_content')) {
function message_content(&$a) {
$o = '';
@ -530,7 +532,9 @@ 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`,
@ -541,7 +545,9 @@ 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();
@ -593,3 +599,4 @@ function render_messages($msg, $t) {
return $rslt;
}
}

View File

@ -2,6 +2,7 @@
require_once('library/asn1.php');
if(! function_exists('modexp_init')) {
function modexp_init(&$a) {
if($a->argc != 2)
@ -29,6 +30,5 @@ function modexp_init(&$a) {
echo 'RSA' . '.' . $m . '.' . $e ;
killme();
}
}

View File

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

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('msearch_post')) {
function msearch_post(&$a) {
$perpage = (($_POST['n']) ? $_POST['n'] : 80);
@ -38,5 +39,5 @@ function msearch_post(&$a) {
echo json_encode($output);
killme();
}
}

View File

@ -2,6 +2,7 @@
require_once("include/nav.php");
if(! function_exists('navigation_content')) {
function navigation_content(&$a) {
$nav_info = nav_info($a);
@ -22,5 +23,5 @@ function navigation_content(&$a) {
'$apps' => $a->apps,
'$clear_notifs' => t('Clear notifications')
));
}
}

View File

@ -1,4 +1,6 @@
<?php
if(! function_exists('network_init')) {
function network_init(&$a) {
if(! local_user()) {
notice( t('Permission denied.') . EOL);
@ -153,9 +155,10 @@ function network_init(&$a) {
$a->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'))
@ -204,7 +207,7 @@ function saved_searches($search) {
));
return $o;
}
}
/**
@ -222,6 +225,7 @@ 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 = '';
@ -278,10 +282,12 @@ 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;
@ -291,7 +297,9 @@ 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;
@ -301,8 +309,9 @@ 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');
@ -886,4 +895,4 @@ function network_content(&$a, $update = 0) {
return $o;
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('newmember_content')) {
function newmember_content(&$a) {
@ -82,3 +83,4 @@ function newmember_content(&$a) {
return $o;
}
}

View File

@ -7,6 +7,7 @@
require_once("include/plugin.php");
if(! function_exists('nodeinfo_wellknown')) {
function nodeinfo_wellknown(&$a) {
if (!get_config("system", "nodeinfo")) {
http_status_exit(404);
@ -19,7 +20,9 @@ function nodeinfo_wellknown(&$a) {
echo json_encode($nodeinfo, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
exit;
}
}
if(! function_exists('nodeinfo_init')) {
function nodeinfo_init(&$a){
if (!get_config("system", "nodeinfo")) {
http_status_exit(404);
@ -143,9 +146,9 @@ function nodeinfo_init(&$a){
echo json_encode($nodeinfo, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
exit;
}
}
if(! function_exists('nodeinfo_cron')) {
function nodeinfo_cron() {
$a = get_app();
@ -260,5 +263,5 @@ function nodeinfo_cron() {
logger("cron_end");
set_config('nodeinfo','last_calucation', time());
}
}
?>

View File

@ -4,6 +4,7 @@ require_once('include/Contact.php');
require_once('include/socgraph.php');
require_once('include/contact_selectors.php');
if(! function_exists('nogroup_init')) {
function nogroup_init(&$a) {
if(! local_user())
@ -17,8 +18,9 @@ function nogroup_init(&$a) {
$a->page['aside'] .= group_side('contacts','group','extended',0,$contact_id);
}
}
if(! function_exists('nogroup_content')) {
function nogroup_content(&$a) {
if(! local_user()) {
@ -66,5 +68,5 @@ function nogroup_content(&$a) {
));
return $o;
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('noscrape_init')) {
function noscrape_init(&$a) {
if($a->argc > 1)
@ -62,5 +63,5 @@ function noscrape_init(&$a) {
header('Content-type: application/json; charset=utf-8');
echo json_encode($json_info);
exit;
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('notes_init')) {
function notes_init(&$a) {
if(! local_user())
@ -12,10 +13,10 @@ function notes_init(&$a) {
nav_set_selected('home');
// profile_load($a,$which,$profile);
}
}
if(! function_exists('notes_content')) {
function notes_content(&$a,$update = false) {
if(! local_user()) {
@ -135,3 +136,4 @@ function notes_content(&$a,$update = false) {
$o .= paginate($a);
return $o;
}
}

View File

@ -1,7 +1,8 @@
<?php
/* identi.ca -> friendica items permanent-url compatibility */
/* identi.ca -> friendica items permanent-url compatibility */
function notice_init(&$a){
if(! function_exists('notice_init')) {
function notice_init(&$a) {
$id = $a->argv[1];
$r = q("SELECT user.nickname FROM user LEFT JOIN item ON item.uid=user.uid WHERE item.id=%d",
intval($id)
@ -16,5 +17,5 @@
}
return;
}
}

View File

@ -3,6 +3,7 @@ include_once("include/bbcode.php");
include_once("include/contact_selectors.php");
include_once("include/Scrape.php");
if(! function_exists('notifications_post')) {
function notifications_post(&$a) {
if(! local_user()) {
@ -58,11 +59,11 @@ function notifications_post(&$a) {
}
}
}
}
if(! function_exists('notifications_content')) {
function notifications_content(&$a) {
if(! local_user()) {
@ -579,3 +580,4 @@ function notifications_content(&$a) {
$o .= paginate($a);
return $o;
}
}

View File

@ -1,6 +1,6 @@
<?php
if(! function_exists('notify_init')) {
function notify_init(&$a) {
if(! local_user())
return;
@ -42,10 +42,10 @@ function notify_init(&$a) {
echo $j;
killme();
}
}
}
if(! function_exists('notify_content')) {
function notify_content(&$a) {
if(! local_user())
return login();
@ -80,5 +80,5 @@ function notify_content(&$a) {
return $o;
}
}

View File

@ -1,7 +1,8 @@
<?php
require_once("include/oembed.php");
function oembed_content(&$a){
if(! function_exists('oembed_content')) {
function oembed_content(&$a) {
// logger('mod_oembed ' . $a->query_string, LOGGER_ALL);
if ($a->argv[1]=='b2h'){
@ -33,3 +34,4 @@ function oembed_content(&$a){
}
killme();
}
}

View File

@ -1,6 +1,6 @@
<?php
if(! function_exists('oexchange_init')) {
function oexchange_init(&$a) {
if(($a->argc > 1) && ($a->argv[1] === 'xrd')) {
@ -11,9 +11,10 @@ function oexchange_init(&$a) {
killme();
}
}
}
if(! function_exists('oexchange_content')) {
function oexchange_content(&$a) {
if(! local_user()) {
@ -52,7 +53,5 @@ function oexchange_content(&$a) {
$_REQUEST = $post;
require_once('mod/item.php');
item_post($a);
}
}

View File

@ -1,9 +1,8 @@
<?php
require_once('library/openid.php');
if(! function_exists('openid_content')) {
function openid_content(&$a) {
$noid = get_config('system','no_openid');
@ -94,3 +93,4 @@ function openid_content(&$a) {
goaway(z_root());
// NOTREACHED
}
}

View File

@ -1,6 +1,6 @@
<?php
function opensearch_content(&$a) {
if(! function_exists('opensearch_content')) {
function opensearch_content(&$a) {
$tpl = get_markup_template('opensearch.tpl');
header("Content-type: application/opensearchdescription+xml");
@ -13,6 +13,6 @@
echo $o;
killme();
}
}
?>

View File

@ -3,6 +3,7 @@
require_once('include/Scrape.php');
require_once('include/follow.php');
if(! function_exists('ostatus_subscribe_content')) {
function ostatus_subscribe_content(&$a) {
if(! local_user()) {
@ -76,3 +77,4 @@ function ostatus_subscribe_content(&$a) {
return $o;
}
}

View File

@ -4,7 +4,8 @@ This file is part of the Diaspora protocol. It is used for fetching single publi
*/
require_once("include/diaspora.php");
function p_init($a){
if(! function_exists('p_init')) {
function p_init($a) {
if ($a->argc != 2) {
header($_SERVER["SERVER_PROTOCOL"].' 510 '.t('Not Extended'));
killme();
@ -79,3 +80,4 @@ function p_init($a){
killme();
}
}

View File

@ -27,6 +27,7 @@ if(!function_exists('deletenode')) {
}
}
if(! function_exists('completeurl')) {
function completeurl($url, $scheme) {
$urlarr = parse_url($url);
@ -53,7 +54,9 @@ function completeurl($url, $scheme) {
return($complete);
}
}
if(! function_exists('parseurl_getsiteinfo_cached')) {
function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = true) {
if ($url == "")
@ -77,7 +80,9 @@ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = tr
return $data;
}
}
if(! function_exists('parseurl_getsiteinfo')) {
function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) {
require_once("include/network.php");
require_once("include/Photo.php");
@ -400,11 +405,15 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
return($siteinfo);
}
}
if(! function_exists('arr_add_hashes')) {
function arr_add_hashes(&$item,$k) {
$item = '#' . $item;
}
}
if(! function_exists('parse_url_content')) {
function parse_url_content(&$a) {
$text = null;
@ -558,4 +567,5 @@ function parse_url_content(&$a) {
killme();
}
}
?>

View File

@ -3,6 +3,7 @@
require_once('include/security.php');
require_once('include/Photo.php');
if(! function_exists('photo_init')) {
function photo_init(&$a) {
global $_SERVER;
@ -209,3 +210,4 @@ function photo_init(&$a) {
killme();
// NOTREACHED
}
}

View File

@ -9,6 +9,7 @@ require_once('include/redir.php');
require_once('include/tags.php');
require_once('include/threads.php');
if(! function_exists('photos_init')) {
function photos_init(&$a) {
if($a->argc > 1)
@ -121,9 +122,9 @@ function photos_init(&$a) {
return;
}
}
if(! function_exists('photos_post')) {
function photos_post(&$a) {
logger('mod-photos: photos_post: begin' , LOGGER_DEBUG);
@ -957,9 +958,9 @@ function photos_post(&$a) {
goaway($a->get_baseurl() . '/' . $_SESSION['photo_return']);
// NOTREACHED
}
}
if(! function_exists('photos_content')) {
function photos_content(&$a) {
// URLs:
@ -1906,4 +1907,4 @@ function photos_content(&$a) {
$o .= paginate($a);
return $o;
}
}

View File

@ -5,6 +5,7 @@ require_once('include/ForumManager.php');
require_once('include/group.php');
require_once("mod/proxy.php");
if(! function_exists('ping_init')) {
function ping_init(&$a) {
header("Content-type: text/xml");
@ -338,7 +339,9 @@ function ping_init(&$a) {
killme();
}
}
if(! function_exists('ping_get_notifications')) {
function ping_get_notifications($uid) {
$result = array();
@ -406,3 +409,4 @@ function ping_get_notifications($uid) {
return($result);
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('poco_init')) {
function poco_init(&$a) {
require_once("include/bbcode.php");
@ -324,5 +325,5 @@ function poco_init(&$a) {
else
http_status_exit(500);
}
}

View File

@ -18,7 +18,7 @@ require_once('include/security.php');
require_once('include/bbcode.php');
require_once('include/items.php');
if(! function_exists('poke_init')) {
function poke_init(&$a) {
if(! local_user())
@ -140,9 +140,9 @@ function poke_init(&$a) {
return;
}
}
if(! function_exists('poke_content')) {
function poke_content(&$a) {
if(! local_user()) {
@ -201,5 +201,5 @@ function poke_content(&$a) {
));
return $o;
}
}

View File

@ -10,6 +10,7 @@ require_once('include/crypto.php');
// not yet ready for prime time
//require_once('include/zot.php');
if(! function_exists('post_post')) {
function post_post(&$a) {
$bulk_delivery = false;
@ -48,4 +49,4 @@ function post_post(&$a) {
http_status_exit(($ret) ? $ret : 200);
// NOTREACHED
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('pretheme_init')) {
function pretheme_init(&$a) {
if($_REQUEST['theme']) {
@ -20,3 +21,4 @@ function pretheme_init(&$a) {
}
killme();
}
}

View File

@ -2,6 +2,7 @@
require_once('include/Scrape.php');
if(! function_exists('probe_content')) {
function probe_content(&$a) {
$o .= '<h3>Probe Diagnostic</h3>';
@ -22,3 +23,4 @@ function probe_content(&$a) {
}
return $o;
}
}

View File

@ -3,7 +3,7 @@
require_once('include/contact_widgets.php');
require_once('include/redir.php');
if(! function_exists('profile_init')) {
function profile_init(&$a) {
if(! x($a->page,'aside'))
@ -65,10 +65,10 @@ function profile_init(&$a) {
foreach($dfrn_pages as $dfrn)
$a->page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"".$a->get_baseurl()."/dfrn_{$dfrn}/{$which}\" />\r\n";
$a->page['htmlhead'] .= "<link rel=\"dfrn-poco\" href=\"".$a->get_baseurl()."/poco/{$which}\" />\r\n";
}
}
if(! function_exists('profile_content')) {
function profile_content(&$a, $update = 0) {
$category = $datequery = $datequery2 = '';
@ -350,3 +350,4 @@ function profile_content(&$a, $update = 0) {
return $o;
}
}

View File

@ -2,6 +2,7 @@
require_once("include/Photo.php");
if(! function_exists('profile_photo_init')) {
function profile_photo_init(&$a) {
if(! local_user()) {
@ -9,10 +10,10 @@ function profile_photo_init(&$a) {
}
profile_load($a,$a->user['nickname']);
}
}
if(! function_exists('profile_photo_post')) {
function profile_photo_post(&$a) {
if(! local_user()) {
@ -164,7 +165,7 @@ function profile_photo_post(&$a) {
$ph->orient($src);
@unlink($src);
return profile_photo_crop_ui_head($a, $ph);
}
}
@ -323,4 +324,3 @@ function profile_photo_crop_ui_head(&$a, $ph){
$a->page['end'] .= replace_macros(get_markup_template("cropend.tpl"), array());
return;
}}

View File

@ -1,6 +1,7 @@
<?php
require_once("include/Contact.php");
if(! function_exists('profiles_init')) {
function profiles_init(&$a) {
nav_set_selected('profiles');
@ -139,9 +140,10 @@ function profiles_init(&$a) {
}
}
}
if(! function_exists('profile_clean_keywords')) {
function profile_clean_keywords($keywords) {
$keywords = str_replace(","," ",$keywords);
$keywords = explode(" ", $keywords);
@ -158,7 +160,9 @@ function profile_clean_keywords($keywords) {
return $keywords;
}
}
if(! function_exists('profiles_post')) {
function profiles_post(&$a) {
if(! local_user()) {
@ -502,8 +506,9 @@ function profiles_post(&$a) {
}
}
}
}
if(! function_exists('profile_activity')) {
function profile_activity($changed, $value) {
$a = get_app();
@ -593,8 +598,9 @@ function profile_activity($changed, $value) {
}
}
}
if(! function_exists('profiles_content')) {
function profiles_content(&$a) {
if(! local_user()) {
@ -818,5 +824,5 @@ function profiles_content(&$a) {
}
return $o;
}
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('profperm_init')) {
function profperm_init(&$a) {
if(! local_user())
@ -9,10 +10,10 @@ function profperm_init(&$a) {
$profile = $a->argv[1];
profile_load($a,$which,$profile);
}
}
if(! function_exists('profperm_content')) {
function profperm_content(&$a) {
if(! local_user()) {
@ -156,6 +157,5 @@ function profperm_content(&$a) {
}
$o .= '</div>';
return $o;
}
}

View File

@ -12,6 +12,7 @@ define("PROXY_SIZE_LARGE", "large");
require_once('include/security.php');
require_once("include/Photo.php");
if(! function_exists('proxy_init')) {
function proxy_init() {
global $a, $_SERVER;
@ -232,7 +233,9 @@ function proxy_init() {
killme();
}
}
if(! function_exists('proxy_url')) {
function proxy_url($url, $writemode = false, $size = "") {
global $_SERVER;
@ -294,11 +297,13 @@ function proxy_url($url, $writemode = false, $size = "") {
else
return ($proxypath.$size);
}
}
/**
* @param $url string
* @return boolean
*/
if(! function_exists('proxy_is_local_image')) {
function proxy_is_local_image($url) {
if ($url[0] == '/') return true;
@ -309,7 +314,9 @@ function proxy_is_local_image($url) {
$url = normalise_link($url);
return (substr($url, 0, strlen($baseurl)) == $baseurl);
}
}
if(! function_exists('proxy_parse_query')) {
function proxy_parse_query($var) {
/**
* Use this function to parse out the query array element from
@ -328,7 +335,9 @@ function proxy_parse_query($var) {
unset($val, $x, $var);
return $arr;
}
}
if(! function_exists('proxy_img_cb')) {
function proxy_img_cb($matches) {
// if the picture seems to be from another picture cache then take the original source
@ -342,10 +351,13 @@ function proxy_img_cb($matches) {
return $matches[1].proxy_url(htmlspecialchars_decode($matches[2])).$matches[3];
}
}
if(! function_exists('proxy_parse_html')) {
function proxy_parse_html($html) {
$a = get_app();
$html = str_replace(normalise_link($a->get_baseurl())."/", $a->get_baseurl()."/", $html);
return preg_replace_callback("/(<img [^>]*src *= *[\"'])([^\"']+)([\"'][^>]*>)/siU", "proxy_img_cb", $html);
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('hub_return')) {
function hub_return($valid,$body) {
if($valid) {
@ -14,18 +15,18 @@ function hub_return($valid,$body) {
// NOTREACHED
}
}
// when receiving an XML feed, always return OK
if(! function_exists('hub_post_return')) {
function hub_post_return() {
header($_SERVER["SERVER_PROTOCOL"] . ' 200 ' . 'OK');
killme();
}
}
if(! function_exists('pubsub_init')) {
function pubsub_init(&$a) {
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
@ -95,9 +96,11 @@ function pubsub_init(&$a) {
hub_return(true, $hub_challenge);
}
}
}
require_once('include/security.php');
if(! function_exists('pubsub_post')) {
function pubsub_post(&$a) {
$xml = file_get_contents('php://input');
@ -155,8 +158,5 @@ function pubsub_post(&$a) {
consume_feed($xml,$importer,$contact,$feedhub,1,2);
hub_post_return();
}
}

View File

@ -1,9 +1,12 @@
<?php
if(! function_exists('post_var')) {
function post_var($name) {
return (x($_POST, $name)) ? notags(trim($_POST[$name])) : '';
}
}
if(! function_exists('pubsubhubbub_init')) {
function pubsubhubbub_init(&$a) {
// PuSH subscription must be considered "public" so just block it
// if public access isn't enabled.
@ -158,5 +161,5 @@ function pubsubhubbub_init(&$a) {
killme();
}
}
?>

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('qsearch_init')) {
function qsearch_init(&$a) {
if(! local_user())
@ -47,4 +48,4 @@ function qsearch_init(&$a) {
echo json_encode((object) $results);
killme();
}
}

View File

@ -1,6 +1,6 @@
<?php
if(! function_exists('randprof_init')) {
function randprof_init(&$a) {
require_once('include/Contact.php');
$x = random_profile();
@ -8,3 +8,4 @@ function randprof_init(&$a) {
goaway(zrl($x));
goaway($a->get_baseurl() . '/profile');
}
}

View File

@ -9,7 +9,7 @@ require_once('include/salmon.php');
require_once('include/crypto.php');
require_once('include/diaspora.php');
if(! function_exists('receive_post')) {
function receive_post(&$a) {
@ -73,4 +73,4 @@ function receive_post(&$a) {
http_status_exit(($ret) ? $ret : 200);
// NOTREACHED
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('redir_init')) {
function redir_init(&$a) {
$url = ((x($_GET,'url')) ? $_GET['url'] : '');
@ -75,3 +76,4 @@ function redir_init(&$a) {
goaway(z_root());
}
}

View File

@ -3,6 +3,7 @@
require_once('include/enotify.php');
require_once('include/user.php');
if(! function_exists('user_allow')) {
function user_allow($hash) {
$a = get_app();
@ -55,14 +56,14 @@ function user_allow($hash) {
info( t('Account approved.') . EOL );
return true;
}
}
}
// This does not have to go through user_remove() and save the nickname
// permanently against re-registration, as the person was not yet
// allowed to have friends on this system
if(! function_exists('user_deny')) {
function user_deny($hash) {
$register = q("SELECT * FROM `register` WHERE `hash` = '%s' LIMIT 1",
@ -91,9 +92,10 @@ function user_deny($hash) {
);
notice( sprintf(t('Registration revoked for %s'), $user[0]['username']) . EOL);
return true;
}
}
if(! function_exists('regmod_content')) {
function regmod_content(&$a) {
global $lang;
@ -131,3 +133,4 @@ function regmod_content(&$a) {
killme();
}
}
}

View File

@ -1,5 +1,6 @@
<?php
if(! function_exists('removeme_post')) {
function removeme_post(&$a) {
if(! local_user())
@ -24,9 +25,10 @@ function removeme_post(&$a) {
user_remove($a->user['uid']);
// NOTREACHED
}
}
}
if(! function_exists('removeme_content')) {
function removeme_content(&$a) {
if(! local_user())
@ -50,5 +52,5 @@ function removeme_content(&$a) {
));
return $o;
}
}

View File

@ -3,6 +3,7 @@
require_once('include/Scrape.php');
require_once('include/follow.php');
if(! function_exists('repair_ostatus_content')) {
function repair_ostatus_content(&$a) {
if(! local_user()) {
@ -55,3 +56,4 @@ function repair_ostatus_content(&$a) {
return $o;
}
}

View File

@ -1,7 +1,6 @@
<?php
if(! function_exists('rsd_xml_content')) {
function rsd_xml_content(&$a) {
header ("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
@ -22,3 +21,4 @@ function rsd_xml_content(&$a) {
';
die();
}
}

View File

@ -6,6 +6,7 @@ require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/follow.php');
if(! function_exists('salmon_return')) {
function salmon_return($val) {
if($val >= 400)
@ -16,9 +17,10 @@ function salmon_return($val) {
logger('mod-salmon returns ' . $val);
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err);
killme();
}
}
if(! function_exists('salmon_post')) {
function salmon_post(&$a) {
$xml = file_get_contents('php://input');
@ -185,3 +187,4 @@ function salmon_post(&$a) {
http_status_exit(200);
}
}

View File

@ -4,6 +4,7 @@ require_once('include/security.php');
require_once('include/conversation.php');
require_once('mod/dirfind.php');
if(! function_exists('search_saved_searches')) {
function search_saved_searches() {
$o = '';
@ -39,10 +40,10 @@ function search_saved_searches() {
}
return $o;
}
}
if(! function_exists('search_init')) {
function search_init(&$a) {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
@ -76,17 +77,18 @@ function search_init(&$a) {
}
}
}
if(! function_exists('search_post')) {
function search_post(&$a) {
if(x($_POST,'search'))
$a->data['search'] = $_POST['search'];
}
}
if(! function_exists('search_content')) {
function search_content(&$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
@ -248,4 +250,4 @@ function search_content(&$a) {
return $o;
}
}

Some files were not shown because too many files have changed in this diff Show More