public function __construct($headline, $nb_projects, $nb_users, $most_secure_url, User_LoginPresenter $login, $display_homepage_news, $news, $user, $awesomeness) { $this->news = $news; $this->login = $login; $this->nb_users = $nb_users; $this->headline = $headline; $this->path_logo = Admin_Homepage_LogoFinder::getCurrentUrl(); $this->awesomeness = $awesomeness; $this->nb_projects = $nb_projects; $this->user = $user; $this->user_is_anonymous = $user->isAnonymous(); $this->most_secure_url = $most_secure_url; $this->display_homepage_news = $display_homepage_news && $news; }
public function __construct(CSRFSynchronizerToken $csrf, $title, $use_standard_homepage, array $headlines) { $this->title = $title; $this->headlines = $headlines; $this->csrf_token = $csrf->fetchHTMLInput(); $this->use_standard_homepage = $use_standard_homepage; $this->path_logo = Admin_Homepage_LogoFinder::getCurrentUrl(); $this->use_custom_logo = Admin_Homepage_LogoFinder::isCustomLogoUsed(); $this->save = $GLOBALS['Language']->getText('admin_main', 'save_conf'); $this->logo = $GLOBALS['Language']->getText('admin_main', 'homepage_logo'); $this->upload = $GLOBALS['Language']->getText('admin_main', 'homepage_upload_logo'); $this->headline = $GLOBALS['Language']->getText('admin_main', 'headline'); $this->logo_help = $GLOBALS['Language']->getText('admin_main', 'homepage_logo_help'); $this->headline_help = $GLOBALS['Language']->getText('admin_main', 'headline_help'); $this->placeholder_headline = $GLOBALS['Language']->getText('admin_main', 'placeholder_headline'); $this->use_standard_homepage_help = $GLOBALS['Language']->getText('admin_main', 'use_standard_homepage_help'); $this->use_standard_homepage_label = $GLOBALS['Language']->getText('admin_main', 'use_standard_homepage_label'); }
private function moveUploadedLogo() { if (!isset($_FILES['logo'])) { return; } $uploaded_logo = $_FILES['logo']; switch ($uploaded_logo['error']) { case UPLOAD_ERR_OK: continue; break; case UPLOAD_ERR_NO_FILE: return; break; case UPLOAD_ERR_INI_SIZE: case UPLOAD_ERR_FORM_SIZE: $this->response->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('admin_main', 'logo_too_big')); return; break; default: $this->response->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('admin_main', 'upload_error', $uploaded_logo['error'])); return; } $imageinfo = getimagesize($uploaded_logo['tmp_name']); if (!$imageinfo || $imageinfo['mime'] !== 'image/png') { $this->response->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('admin_main', 'no_png')); return; } $height_index = 1; if ($imageinfo[$height_index] > 100) { $this->response->addFeedback(Feedback::ERROR, $GLOBALS['Language']->getText('admin_main', '100px')); return; } return move_uploaded_file($uploaded_logo['tmp_name'], Admin_Homepage_LogoFinder::getCustomPath()); }