@ -58,7 +58,7 @@ function admin_post(App $a)
case 'users' :
admin_page_users_post ( $a );
break ;
case 'plugi ns' :
case 'addo ns' :
if ( $a -> argc > 2 &&
is_file ( " addon/ " . $a -> argv [ 2 ] . " / " . $a -> argv [ 2 ] . " .php " )) {
@ include_once ( " addon/ " . $a -> argv [ 2 ] . " / " . $a -> argv [ 2 ] . " .php " );
@ -67,7 +67,7 @@ function admin_post(App $a)
$func ( $a );
}
}
$return_path = 'admin/plugi ns/' . $a -> argv [ 2 ];
$return_path = 'admin/addo ns/' . $a -> argv [ 2 ];
break ;
case 'themes' :
if ( $a -> argc < 2 ) {
@ -172,7 +172,7 @@ function admin_content(App $a)
$aside_sub = [
'site' => [ " admin/site/ " , t ( " Site " ) , " site " ],
'users' => [ " admin/users/ " , t ( " Users " ) , " users " ],
'plugins' => [ " admin/plugins/ " , t ( " Plugi ns" ) , " plugi ns" ],
'addons' => [ " admin/addons/ " , t ( " Addo ns" ) , " addo ns" ],
'themes' => [ " admin/themes/ " , t ( " Themes " ) , " themes " ],
'features' => [ " admin/features/ " , t ( " Additional features " ) , " features " ],
'dbsync' => [ " admin/dbsync/ " , t ( 'DB updates' ) , " dbsync " ],
@ -183,15 +183,15 @@ function admin_content(App $a)
'deleteitem' => [ " admin/deleteitem/ " , t ( 'Delete Item' ) , 'deleteitem' ],
];
/* get plugi ns admin page */
/* get addo ns admin page */
$r = q ( " SELECT `name` FROM `addon` WHERE `plugin_admin` = 1 ORDER BY `name` " );
$aside_tools [ 'plugi ns_admin' ] = [];
$aside_tools [ 'addo ns_admin' ] = [];
foreach ( $r as $h ) {
$plugi n = $h [ 'name' ];
$aside_tools [ 'plugi ns_admin' ][] = [ " admin/plugins/ " . $plugin , $plugin , " plugi n " ];
// temp plugi ns with admin
$a -> plugins_admin [] = $plugi n;
$addo n = $h [ 'name' ];
$aside_tools [ 'addo ns_admin' ][] = [ " admin/addons/ " . $addon , $addon , " addo n " ];
// temp addo ns with admin
$a -> addons_admin [] = $addo n;
}
$aside_tools [ 'logs' ] = [ " admin/logs/ " , t ( " Logs " ), " logs " ];
@ -204,7 +204,7 @@ function admin_content(App $a)
'$admin' => $aside_tools ,
'$subpages' => $aside_sub ,
'$admtxt' => t ( 'Admin' ),
'$plugadmtxt' => t ( 'Plugi n Features' ),
'$plugadmtxt' => t ( 'Addo n Features' ),
'$logtxt' => t ( 'Logs' ),
'$diagnosticstxt' => t ( 'diagnostics' ),
'$h_pending' => t ( 'User registrations waiting for confirmation' ),
@ -222,8 +222,8 @@ function admin_content(App $a)
case 'users' :
$o = admin_page_users ( $a );
break ;
case 'plugi ns' :
$o = admin_page_plugi ns ( $a );
case 'addo ns' :
$o = admin_page_addo ns ( $a );
break ;
case 'themes' :
$o = admin_page_themes ( $a );
@ -781,7 +781,7 @@ function admin_page_summary(App $a)
'$platform' => FRIENDICA_PLATFORM ,
'$codename' => FRIENDICA_CODENAME ,
'$build' => Config :: get ( 'system' , 'build' ),
'$plugi ns' => [ t ( 'Active plugi ns' ), $a -> plugi ns],
'$addo ns' => [ t ( 'Active addo ns' ), $a -> addo ns],
'$showwarning' => $showwarning ,
'$warningtext' => $warningtext
]);
@ -1725,54 +1725,54 @@ function admin_page_users(App $a)
}
/**
* @ brief Plugi ns admin page
* @ brief Addo ns admin page
*
* This function generates the admin panel page for managing plugi ns on the
* friendica node . If a plugi n name is given a single page showing the details
* This function generates the admin panel page for managing addo ns on the
* friendica node . If an addo n name is given a single page showing the details
* for this addon is generated . If no name is given , a list of available
* plugi ns is shown .
* addo ns is shown .
*
* The template used for displaying the list of plugi ns and the details of the
* plugi n are the same as used for the templates .
* The template used for displaying the list of addo ns and the details of the
* addo n are the same as used for the templates .
*
* The returned string returned hulds the HTML code of the page .
*
* @ param App $a
* @ return string
*/
function admin_page_plugi ns ( App $a )
function admin_page_addo ns ( App $a )
{
/*
* Single plugi n
* Single addo n
*/
if ( $a -> argc == 3 ) {
$plugi n = $a -> argv [ 2 ];
if ( ! is_file ( " addon/ $plugin / $plugi n .php " )) {
$addo n = $a -> argv [ 2 ];
if ( ! is_file ( " addon/ $addon / $addo n .php " )) {
notice ( t ( " Item not found. " ));
return '' ;
}
if ( x ( $_GET , " a " ) && $_GET [ 'a' ] == " t " ) {
check_form_security_token_redirectOnErr ( '/admin/plugi ns' , 'admin_themes' , 't' );
check_form_security_token_redirectOnErr ( '/admin/addo ns' , 'admin_themes' , 't' );
// Toggle plugi n status
$idx = array_search ( $plugi n , $a -> plugi ns);
// Toggle addo n status
$idx = array_search ( $addo n , $a -> addo ns);
if ( $idx !== false ) {
unset ( $a -> plugi ns[ $idx ]);
Addon :: uninstall ( $plugi n );
info ( t ( " Plugin %s disabled. " , $plugi n));
unset ( $a -> addo ns[ $idx ]);
Addon :: uninstall ( $addo n );
info ( t ( " Addon %s disabled. " , $addo n));
} else {
$a -> plugins [] = $plugi n;
Addon :: install ( $plugi n );
info ( t ( " Plugin %s enabled. " , $plugi n));
$a -> addons [] = $addo n;
Addon :: install ( $addo n );
info ( t ( " Addon %s enabled. " , $addo n));
}
Config :: set ( " system " , " addon " , implode ( " , " , $a -> plugi ns));
goaway ( 'admin/plugi ns' );
Config :: set ( " system " , " addon " , implode ( " , " , $a -> addo ns));
goaway ( 'admin/addo ns' );
return '' ; // NOTREACHED
}
// display plugi n details
if ( in_array ( $plugi n , $a -> plugi ns)) {
// display addo n details
if ( in_array ( $addo n , $a -> addo ns)) {
$status = " on " ;
$action = t ( " Disable " );
} else {
@ -1781,16 +1781,16 @@ function admin_page_plugins(App $a)
}
$readme = Null ;
if ( is_file ( " addon/ $plugi n /README.md " )) {
$readme = Markdown :: convert ( file_get_contents ( " addon/ $plugi n /README.md " ), false );
} elseif ( is_file ( " addon/ $plugi n /README " )) {
$readme = " <pre> " . file_get_contents ( " addon/ $plugi n /README " ) . " </pre> " ;
if ( is_file ( " addon/ $addo n /README.md " )) {
$readme = Markdown :: convert ( file_get_contents ( " addon/ $addo n /README.md " ), false );
} elseif ( is_file ( " addon/ $addo n /README " )) {
$readme = " <pre> " . file_get_contents ( " addon/ $addo n /README " ) . " </pre> " ;
}
$admin_form = " " ;
if ( in_array ( $plugi n , $a -> plugi ns_admin)) {
@ require_once ( " addon/ $plugin / $plugi n .php " );
$func = $plugi n . '_plugin_admin' ;
if ( in_array ( $addo n , $a -> addo ns_admin)) {
@ require_once ( " addon/ $addon / $addo n .php " );
$func = $addo n . '_plugin_admin' ;
$func ( $a , $admin_form );
}
@ -1798,20 +1798,20 @@ function admin_page_plugins(App $a)
return replace_macros ( $t , [
'$title' => t ( 'Administration' ),
'$page' => t ( 'Plugi ns' ),
'$page' => t ( 'Addo ns' ),
'$toggle' => t ( 'Toggle' ),
'$settings' => t ( 'Settings' ),
'$baseurl' => System :: baseUrl ( true ),
'$plugin' => $plugi n ,
'$addon' => $addo n ,
'$status' => $status ,
'$action' => $action ,
'$info' => Addon :: getInfo ( $plugi n ),
'$info' => Addon :: getInfo ( $addo n ),
'$str_author' => t ( 'Author: ' ),
'$str_maintainer' => t ( 'Maintainer: ' ),
'$admin_form' => $admin_form ,
'$function' => 'plugi ns' ,
'$function' => 'addo ns' ,
'$screenshot' => '' ,
'$readme' => $readme ,
@ -1820,36 +1820,36 @@ function admin_page_plugins(App $a)
}
/*
* List plugi ns
* List addo ns
*/
if ( x ( $_GET , " a " ) && $_GET [ 'a' ] == " r " ) {
check_form_security_token_redirectOnErr ( System :: baseUrl () . '/admin/plugi ns' , 'admin_themes' , 't' );
check_form_security_token_redirectOnErr ( System :: baseUrl () . '/admin/addo ns' , 'admin_themes' , 't' );
Addon :: reload ();
info ( " Plugi ns reloaded" );
goaway ( System :: baseUrl () . '/admin/plugi ns' );
info ( " Addo ns reloaded" );
goaway ( System :: baseUrl () . '/admin/addo ns' );
}
$plugi ns = [];
$addo ns = [];
$files = glob ( " addon/*/ " );
if ( is_array ( $files )) {
foreach ( $files as $file ) {
if ( is_dir ( $file )) {
list ( $tmp , $id ) = array_map ( " trim " , explode ( " / " , $file ));
$info = Addon :: getInfo ( $id );
$show_plugi n = true ;
$show_addo n = true ;
// If the addon is unsupported, then only show it, when it is enabled
if (( strtolower ( $info [ " status " ]) == " unsupported " ) && ! in_array ( $id , $a -> plugi ns)) {
$show_plugi n = false ;
if (( strtolower ( $info [ " status " ]) == " unsupported " ) && ! in_array ( $id , $a -> addo ns)) {
$show_addo n = false ;
}
// Override the above szenario, when the admin really wants to see outdated stuff
if ( Config :: get ( " system " , " show_unsupported_addons " )) {
$show_plugi n = true ;
$show_addo n = true ;
}
if ( $show_plugi n ) {
$plugi ns [] = [ $id , ( in_array ( $id , $a -> plugi ns) ? " on " : " off " ), $info ];
if ( $show_addo n ) {
$addo ns [] = [ $id , ( in_array ( $id , $a -> addo ns) ? " on " : " off " ), $info ];
}
}
}
@ -1858,14 +1858,14 @@ function admin_page_plugins(App $a)
$t = get_markup_template ( 'admin/plugins.tpl' );
return replace_macros ( $t , [
'$title' => t ( 'Administration' ),
'$page' => t ( 'Plugi ns' ),
'$page' => t ( 'Addo ns' ),
'$submit' => t ( 'Save Settings' ),
'$reload' => t ( 'Reload active plugi ns' ),
'$reload' => t ( 'Reload active addo ns' ),
'$baseurl' => System :: baseUrl ( true ),
'$function' => 'plugi ns' ,
'$plugins' => $plugi ns ,
'$pcount' => count ( $plugi ns ),
'$noplugshint' => 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 plugi n registry at %2$s' , 'https://github.com/friendica/friendica-addons' , 'http://addons.friendi.ca' ),
'$function' => 'addo ns' ,
'$addons' => $addo ns ,
'$pcount' => count ( $addo ns ),
'$noplugshint' => t ( 'There are currently no addons available on your node. You can find the official addon repository at %1$s and might find other interesting addons in the open addo n registry at %2$s' , 'https://github.com/friendica/friendica-addons' , 'http://addons.friendi.ca' ),
'$form_security_token' => get_form_security_token ( " admin_themes " ),
]);
}
@ -1940,7 +1940,7 @@ function rebuild_theme_table($themes)
* themes is generated .
*
* The template used for displaying the list of themes and the details of the
* themes are the same as used for the plugi ns.
* themes are the same as used for the addo ns.
*
* The returned string contains the HTML code of the admin panel page .
*
@ -2071,7 +2071,7 @@ function admin_page_themes(App $a)
'$toggle' => t ( 'Toggle' ),
'$settings' => t ( 'Settings' ),
'$baseurl' => System :: baseUrl ( true ),
'$plugi n' => $theme ,
'$addo n' => $theme ,
'$status' => $status ,
'$action' => $action ,
'$info' => Theme :: getInfo ( $theme ),
@ -2103,9 +2103,9 @@ function admin_page_themes(App $a)
* List themes
*/
$plugi ns = [];
$addo ns = [];
foreach ( $themes as $th ) {
$plugi ns [] = [ $th [ 'name' ], (( $th [ 'allowed' ]) ? " on " : " off " ), Theme :: getInfo ( $th [ 'name' ])];
$addo ns [] = [ $th [ 'name' ], (( $th [ 'allowed' ]) ? " on " : " off " ), Theme :: getInfo ( $th [ 'name' ])];
}
$t = get_markup_template ( 'admin/plugins.tpl' );
@ -2116,7 +2116,7 @@ function admin_page_themes(App $a)
'$reload' => t ( 'Reload active themes' ),
'$baseurl' => System :: baseUrl ( true ),
'$function' => 'themes' ,
'$plugins' => $plugi ns ,
'$addons' => $addo ns ,
'$pcount' => count ( $themes ),
'$noplugshint' => t ( 'No themes found on the system. They should be placed in %1$s' , '<code>/view/themes</code>' ),
'$experimental' => t ( '[Experimental]' ),