logic that i understand..
This commit is contained in:
parent
68e20d9ff1
commit
51cda6f1da
|
@ -121,17 +121,30 @@ class QvitterPlugin extends Plugin {
|
|||
{
|
||||
// check if we should reroute UI to qvitter, and which home-stream the user wants (hide-replies or normal)
|
||||
$scoped = Profile::current();
|
||||
$qvitter_enabled_by_user = false;
|
||||
$qvitter_disabled_by_user = false;
|
||||
$qvitter_enabled_by_user = 0;
|
||||
$qvitter_disabled_by_user = 0;
|
||||
if ($scoped instanceof Profile) {
|
||||
$qvitter_enabled_by_user = (int)$scoped->getPref('qvitter', 'enable_qvitter', false);
|
||||
$qvitter_disabled_by_user = (int)$scoped->getPref('qvitter', 'disable_qvitter', false);
|
||||
$this->qvitter_hide_replies = $scoped->getPref('qvitter', 'hide_replies', false);
|
||||
}
|
||||
|
||||
$this->hijack_ui = (self::settings('enabledbydefault') && !$scoped)
|
||||
|| (self::settings('enabledbydefault') && $qvitter_disabled_by_user == 0)
|
||||
|| (!self::settings('enabledbydefault') && $qvitter_enabled_by_user == 1);
|
||||
// reroute to qvitter if we're logged out and qvitter is enabled by default
|
||||
if(self::settings('enabledbydefault') === true && !$scoped) {
|
||||
$this->hijack_ui = true;
|
||||
}
|
||||
// if we're logged in and qvitter is enabled by default, reroute if the user has not disabled qvitter
|
||||
elseif(self::settings('enabledbydefault') === true && $qvitter_disabled_by_user == 0){
|
||||
$this->hijack_ui = true;
|
||||
}
|
||||
// if we're logged in, and qvitter is _not_ enabled by default, reroute if the user enabled qvitter
|
||||
elseif(self::settings('enabledbydefault') === false && $qvitter_enabled_by_user == 1) {
|
||||
$this->hijack_ui = true;
|
||||
}
|
||||
// otherwise we do not reroute
|
||||
else {
|
||||
$this->hijack_ui = false;
|
||||
}
|
||||
|
||||
// show qvitter link in the admin panel
|
||||
common_config_append('admin', 'panels', 'qvitteradm');
|
||||
|
|
Loading…
Reference in New Issue
Block a user