HEX
Server: Apache/2.4.25 (Debian)
System: Linux server17 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
User: web37 (1062)
PHP: 7.4.30
Disabled: show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, disk_total_space, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen
Upload Files
File: /var/www/web37/htdocs/fickanzeiger/controllers/ContactController.php
<?php
/**
 * Arfooo
 * 
 * @package    Arfooo
 * @copyright  Copyright (c) Arfooo Annuaire (fr) and Arfooo Directory (en)
 *             by Guillaume Hocine (c) 2007 - 2010
 *             http://www.arfooo.com/ (fr) and http://www.arfooo.net/ (en)
 * @author     Guillaume Hocine & Adrian Galewski
 * @license    http://creativecommons.org/licenses/by/2.0/fr/ Creative Commons
 */


class ContactController extends AppController
{
    /**
     * Display contact form
     */
    function indexAction()
    {
        Display::set("adPage", "contact");

        if (!Config::get("contactPageEnabled")) {
            return $this->return404();
        }
    }

    function problemPopupAction($itemId)
    {
        $item = $this->site->findByPk($itemId);
        if (empty($item)) {
            $this->return404();
        }
        $this->set("item", $item);
    }

    function saveItemProblemAction()
    {
        if (empty($this->request->siteId)
            || !($site = $this->site->findByPk($this->request->siteId))
        ) {
            $this->return404();
        }

        $this->viewClass = "JsonView";

        $errorMessage = $this->siteProblem->validate($this->request);

        if (Config::get('captchaEnabledOnContactForm')
            && !$errorMessage
            && !$this->captchaCode->validatePublicAndPrivateCodes($this->request)
        ) {
            $errorMessage = 'You did not guess the security code.';
        }

        if (empty($errorMessage)) {
            $itemProblem = new SiteProblemRecord();
            $itemProblem->fromArray($this->request->getArray(array("siteId",
                                                                   "type",
                                                                   "description")));
            $itemProblem->save();

            if (Config::get("sendEmailsOnSiteProblem")) {
                Mailer::getInstance()->sendNewSiteProblemNotificationToAdmin($site);
            }

            $this->set("status", "ok");
        } else {
            $this->set("status", "error");
            $this->set("message", _t($errorMessage));
        }
    }

    function contactPopupAction($itemId)
    {
        $item = $this->site->findByPk($itemId);
        if (empty($item)) {
            $this->return404();
        }

        $user = $this->user->findByPk($item->webmasterId);
        $this->set("item", $item);
        $this->set("user", $user);
    }

    function sendMessageToUserAction()
    {
        $this->viewClass = "JsonView";
        $itemId = $this->request->siteId;
        $item = $this->site->findByPk($itemId);
        if (empty($item)) {
            $this->return404();
        }

        $errorMessage = "";

        if (Config::get('captchaEnabledOnContactForm')
            && $this->session->get("role") != "administrator"
            && $this->session->get("role") != "moderator"
            && !$errorMessage
            && !$this->captchaCode->validatePublicAndPrivateCodes($this->request)
        ) {
            $errorMessage = 'You did not guess the security code.';
        }

        if (empty($errorMessage)) {
            Mailer::getInstance()->sendContactEmailToUser($item->webmasterEmail,
                                                          $this->request->title,
                                                          $this->request->description,
                                                          $this->request->yourEmail);

            $this->set("status", "ok");
        } else {
            $this->set("status", "error");
            $this->set("message", _t($errorMessage));
        }
    }

    function sendMessageToAdminAction()
    {
        $this->viewClass = "JsonView";

        $errorMessage = "";

        if (Config::get('captchaEnabledOnContactForm')
            && !$errorMessage
            && !$this->captchaCode->validatePublicAndPrivateCodes($this->request)
        ) {
            $errorMessage = 'You did not guess the security code.';
        }

        if (empty($errorMessage)) {
            Mailer::getInstance()->sendEmail(Mailer::getInstance()->getAdminEmail(),
                                             $this->request->title,
                                             $this->request->description,
                                             $this->request->yourEmail);

            $this->set("status", "ok");
        } else {
            $this->set("status", "error");
            $this->set("message", _t($errorMessage));
        }
    }
}