1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
hubzilla_ynh/sources/addon/keepout/keepout.php
2016-04-17 22:42:29 +05:30

45 lines
No EOL
1.5 KiB
PHP

<?php
/**
* Name: Keep Out
* Description: Block public completely, IMPORTANT: off grid use ONLY
* Version: 1.0
* Author: Macgirvin
* Maintainer: none
* MinVersion: 1.1.4
*
*/
function keepout_urls() {
return array(
'blocks','bookmarks','channel','chat','cloud','connections','connedit','cover_photo','directory','dirsearch','display','editblock','editlayout','editpost','editwebpage','events','feed','filestorage','hcard','hostxrd','layouts','mail','manage','menu','mitem','network','online','page','pconfig','pdledit','photos','poco','profile','public','search','siteinfo','siteinfo_json','thing','viewsrc','webpages','wfinger','xchan','xpoco','xrd','zcard','zotfeed');
}
function keepout_load() {
foreach(keepout_urls() as $x) {
register_hook($x . '_mod_init', 'addon/keepout/keepout.php', 'keepout_mod_init');
register_hook($x . '_mod_content', 'addon/keepout/keepout.php', 'keepout_mod_content');
}
}
function keepout_unload() {
foreach(keepout_urls() as $x) {
unregister_hook($x . '_mod_init', 'addon/keepout/keepout.php', 'keepout_mod_init');
unregister_hook($x . '_mod_content', 'addon/keepout/keepout.php', 'keepout_mod_content');
}
}
function keepout_mod_init(&$a,&$b) {
if((get_config('system','block_public')) && (! get_account_id()) && (! remote_channel())) {
notice( t('Permission denied.') . EOL);
$b['replace'] = true;
}
}
function keepout_mod_content(&$a,&$b) {
if((get_config('system','block_public')) && (! get_account_id()) && (! remote_channel()))
$b['replace'] = true;
}