Skip to content

Commit

Permalink
Fix cPanel user initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
the-djmaze committed Nov 24, 2022
1 parent 6c8d8d5 commit 56fe363
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
20 changes: 14 additions & 6 deletions snappymail/v/0.0.0/app/libraries/RainLoop/Plugins/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,11 @@ public function __construct(\RainLoop\Actions $oActions)
if (\strlen($sList)) {
$aList = \SnappyMail\Repository::getEnabledPackagesNames();
foreach ($aList as $i => $sName) {
$oPlugin = $this->CreatePluginByName($sName);
if ($oPlugin) {
$oPlugin->Init();
$this->aPlugins[] = $oPlugin;
} else {
if (!$this->loadPlugin($sName)) {
unset($aList[$i]);
}
}
$aList = \implode(',', \array_unique($aList));
$aList = \implode(',', \array_keys($this->aPlugins));
if ($sList != $aList) {
$oConfig->Set('plugins', 'enabled_list', $aList);
$oConfig->Save();
Expand All @@ -58,6 +54,18 @@ public function __construct(\RainLoop\Actions $oActions)
}
}

public function loadPlugin(string $sName) : bool
{
if (!isset($this->aPlugins[$sName])) {
$oPlugin = $this->CreatePluginByName($sName);
if ($oPlugin) {
$oPlugin->Init();
$this->aPlugins[$sName] = $oPlugin;
}
}
return isset($this->aPlugins[$sName]);
}

protected static function getPluginPath(string $sName) : ?string
{
$sPath = APP_PLUGINS_PATH.$sName;
Expand Down
6 changes: 6 additions & 0 deletions snappymail/v/0.0.0/cpanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@
file_put_contents($sFile, json_encode($config, JSON_PRETTY_PRINT));
}

// \RainLoop\Api::Actions()->Plugins()->loadPlugin('login-remote');
if (!isset($_GET['installed'])) {
\header('Location: ?RemoteAutoLogin&installed');
exit;
}

$_ENV['SNAPPYMAIL_INCLUDE_AS_API'] = $asApi;
}

0 comments on commit 56fe363

Please sign in to comment.