2019-04-30 23:52:07 +00:00
< ? php
2022-02-16 04:08:28 +00:00
namespace Code\Module ;
2019-04-30 23:52:07 +00:00
2022-02-16 04:08:28 +00:00
use Code\Lib\Libsync ;
use Code\Lib\Apps ;
use Code\Web\Controller ;
2019-04-30 23:52:07 +00:00
2021-12-02 23:02:31 +00:00
class Suggestions extends Controller
{
public function init ()
{
2021-12-03 03:01:39 +00:00
if ( ! local_channel ()) {
2021-12-02 23:02:31 +00:00
return ;
2021-12-03 03:01:39 +00:00
}
2021-12-02 23:02:31 +00:00
if ( x ( $_GET , 'ignore' )) {
2021-12-03 03:01:39 +00:00
q (
" insert into xign ( uid, xchan ) values ( %d, '%s' ) " ,
2021-12-02 23:02:31 +00:00
intval ( local_channel ()),
dbesc ( $_GET [ 'ignore' ])
);
Libsync :: build_sync_packet ( local_channel (), [ 'xign' => [[ 'uid' => local_channel (), 'xchan' => $_GET [ 'ignore' ]]]]);
}
}
public function get ()
{
$o = '' ;
if ( ! local_channel ()) {
notice ( t ( 'Permission denied.' ) . EOL );
return ;
}
if ( Apps :: system_app_installed ( local_channel (), 'Suggest Channels' )) {
2019-04-30 23:52:07 +00:00
goaway ( z_root () . '/directory?f=&suggest=1' );
}
2021-12-02 23:02:31 +00:00
$desc = t ( 'This app (when installed) displays a small number of friend suggestions on selected pages or you can run the app to display a full list of channel suggestions.' );
2019-04-30 23:52:07 +00:00
return '<div class="section-content-info-wrapper">' . $desc . '</div>' ;
2021-12-02 23:02:31 +00:00
}
2019-04-30 23:52:07 +00:00
}