function send_new_user_email($to, $login, $password, $confirm_hash, $template, $isAdminPresenter) { //needed by new_user_email.txt $base_url = get_server_url(); $defaultTheme = $GLOBALS['sys_themedefault']; $color_logo = "#0000"; $color_button = "#347DBA"; if (themeIsFlamingParrot($defaultTheme)) { $defaultThemeVariant = $GLOBALS['sys_default_theme_variant']; $color_logo = FlamingParrot_Theme::getColorOfCurrentTheme($defaultThemeVariant); $color_button = $color_logo; } $logo_url = $base_url . "/themes/" . $defaultTheme . "/images/organization_logo.png"; $has_logo = file_exists(dirname(__FILE__) . '/../themes/' . $defaultTheme . '/images/organization_logo.png'); if ($isAdminPresenter) { $subject = $GLOBALS['Language']->getText('account_register', 'welcome_email_title', $GLOBALS['sys_name']); include $GLOBALS['Language']->getContent('account/new_account_email'); $presenter = new MailRegisterByAdminPresenter($has_logo, $logo_url, $title, $section_one, $section_two, $section_after_login, $thanks, $signature, $help, $color_logo, $login, $section_three, $section_after_password, $password); } else { $subject = $GLOBALS['Language']->getText('include_proj_email', 'account_register', $GLOBALS['sys_name']); include $GLOBALS['Language']->getContent('include/new_user_email'); $redirect_url = $base_url . "/account/verify.php?confirm_hash={$confirm_hash}"; $presenter = new MailRegisterByUserPresenter($has_logo, $logo_url, $title, $section_one, $section_two, $section_after_login, $thanks, $signature, $help, $color_logo, $login, $redirect_url, $redirect_button, $color_button); } $renderer = TemplateRendererFactory::build()->getRenderer(ForgeConfig::get('codendi_dir') . '/src/templates/mail/'); $mail = initializeMail($subject, $GLOBALS['sys_noreply'], $to, $renderer->renderToString($template, $presenter), $message); return $mail->send(); }
private function unsetInvalidThemes() { foreach ($this->allowed as $index => $item) { if (!in_array($item, FlamingParrot_Theme::getVariants())) { unset($this->allowed[$index]); } } $this->allowed = array_values($this->allowed); }
/** * Return the color of theme * with references parameters * * @return string */ private function setColorTheme(&$color_logo = null, &$color_button = null) { $defaultTheme = ForgeConfig::get('sys_themedefault'); if ($this->themeIsFlamingParrot($defaultTheme)) { $defaultThemeVariant = ForgeConfig::get('sys_default_theme_variant'); $color_logo = FlamingParrot_Theme::getColorOfCurrentTheme($defaultThemeVariant); $color_button = $color_logo; } }