function forcePipeline() { if (!$this->allowedAdminAccess) { return; } if (isset($_POST['forcePipeline'])) { setGlobalConfigItem('forcePipeline', $_POST['forcePipeline']); } $template = $this->getThemeFragment('admin-force-pipeline.htmlf'); $pipelinesDirectory = dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'pipeline' . DIRECTORY_SEPARATOR; $pipelines = glob($pipelinesDirectory . '*'); $optionsHtmlString = ''; $forcedPipeline = getGlobalConfigItem('forcePipeline'); foreach ($pipelines as $pipeline) { $optionsHtmlString .= '<option value="' . basename($pipeline) . '" '; if (basename($pipeline) == $forcedPipeline) { $optionsHtmlString .= ' selected="selected" '; } $optionsHtmlString .= '>' . basename($pipeline) . '</option>'; } $template = str_replace('{{pipelines}}', $optionsHtmlString, $template); $forcePipeline = getGlobalConfigItem('forcePipeline'); if ($forcePipeline == null) { $template = str_replace('{{forcePipelineEnabled}}', '', $template); $template = str_replace('{{freelyChoosePipelinesEnabled}}', 'disabled="disabled" style="background:#99ff99;border:none"', $template); } else { $template = str_replace('{{forcePipelineEnabled}}', ' style="background:#99ff99;color:black"', $template); $template = str_replace('{{freelyChoosePipelinesEnabled}}', ' ', $template); } return $template; }
static function setAdminPassword($password) { return setGlobalConfigItem('adminPassword', Security::hashPassword($password)); }