ilch Forum » Ilch CMS 2.X » Fehlersuche und Probleme » [ERLEDIGT] Registrierung

Geschlossen
  1. #1
    User Pic
    Slipi ilch.de Design
    Registriert seit
    19.01.2018
    Beiträge
    938
    Beitragswertungen
    117 Beitragspunkte
    Durch das testen der Registrierung, kam diese Fehlermeldung.

    Warning: strpos() [function.strpos]: Empty needle in /users/slipi/www/application/libraries/Ilch/Functions.php on line 307 

    Warning: Cannot modify header information - headers already sent by (output started at /users/slipi/www/application/libraries/Ilch/Functions.php:307) in /users/slipi/www/application/libraries/Ilch/Redirect.php on line 157

    Im Admincenter wird aber eine Freischaltung angezeigt.

    LG


    verwendete ilch Version: 2.x

    betroffene Homepage: www.slipi.square7.ch


    Zuletzt modifiziert von Slipi am 13.06.2018 - 10:52:37
    0 Mitglieder finden den Beitrag gut.
  2. #2
    User Pic
    Slipi ilch.de Design
    Registriert seit
    19.01.2018
    Beiträge
    938
    Beitragswertungen
    117 Beitragspunkte
    Hab versucht einen test-user zu registrieren.
    Wenn ich die Fehlermeldung schließe, wird im Reg Bereich angegeben "keine gültige Mail Adresse".

    code Functions.php
    function isEmailOnBlacklist($emailAddress)
    {
        if (empty($emailAddress)) {
            return false;
        }
    
        $emailBlacklist = explode(PHP_EOL, \Ilch\Registry::get('config')->get('emailBlacklist'));
        foreach ($emailBlacklist as $entry) {
            ------->if (strpos($emailAddress, trim($entry)) !== false) { <---------Zeile 307
                return true;
            }
        }
    
        return false;
    }



    Redirect.php

    <?php
    
    namespace Ilch;
    
    class Redirect
    {
        /**
         * The current request instance
         *
         * @var \Ilch\Request
         */
        protected $request;
    
        /**
         * The translator instance
         *
         * @var \Ilch\Translator
         */
        protected $translator;
    
        /**
         * Flash messages translation keys
         *
         * @var string
         */
        protected $messages = array();
    
        /**
         * Input for the next request.
         *
         * @var array
         */
        protected $input = array();
    
        /**
         * The errors for the next request.
         *
         * @var array
         */
        protected $errors = array();
    
        /**
         * Constructor
         *
         * @param \Ilch\Request $request Request instance
         */
        public function __construct($request)
        {
            $this->request = $request;
            $this->translator = \Ilch\Registry::get('translator');
        }
    
        /**
         * Adds a flash message
         *
         * @param  string $message Translation key for the flash message
         * @return self
         */
        public function withMessage($message, $type = 'success')
        {
            if (!is_string($message)) {
                throw new \Exception("Wrong parameter type: expected string, got ".gettype($message));
            }
    
            array_push($this->messages, ['text' => $message, 'type' => $type]);
    
            return $this;
        }
    
        /**
         * Sets the input for the next request.
         *
         * @param array|null $input Input data
         * @return self
         */
        public function withInput($input = null)
        {
            if (is_null($input)) {
                $input = $this->request->getPost();
            }
    
            $this->input = array_merge($this->input, $input);
    
            return $this;
        }
    
        /**
         * Sets the errors for the next request.
         *
         * @param \Ilch\Validation\ErrorBag $errorBag The errorBag instance
         *
         * @return self
         */
        public function withErrors(\Ilch\Validation\ErrorBag $errorBag)
        {
            $this->errors = array_merge($this->errors, $errorBag->getErrors());
    
            return $this;
        }
    
        /**
         * Redirects the user to $destination.
         *
         * @param mixed $destination
         * @param bool  $route
         * @param int   $status
         * @param array $headers
         */
        public function to($destination, $route = null, $status = 302, $headers = [])
        {
            if (!is_string($destination) || preg_match('~^[a-z]+://.*~', $destination) === 0) {
                $destination = $this->getUrl($destination, $route);
            }
    
            $this->perform($destination, $status, $headers);
        }
    
        /**
         * Redirects to the desired location.
         *
         * @param string    $default Default location
         * @param int       $status  HTTP Status Code
         * @param array     $headers An array with headers
         * @param bool|null $secure  Whether or not it is a secure request
         */
        protected function perform($destination = '/', $status = 302, $headers = [])
        {
            if (!empty($this->errors)) {
                array_dot_set($_SESSION, 'ilch_validation_errors', $this->errors);
            }
    
            if (!empty($this->input)) {
                array_dot_set($_SESSION, 'ilch_old_input', $this->input);
            }
    
            if (!empty($this->messages)) {
                $messages = array();
    
                foreach ($this->messages as $message) {
                    $messages[] = [
                        'text' => $this->translator->trans($message['text']),
                        'type' => $message['type'],
                    ];
                }
    
                if (is_array(array_dot($_SESSION, 'messages'))) {
                    array_dot_set($_SESSION, 'messages', array_merge(array_dot($_SESSION, 'messages'), $messages));
                } else {
                    array_dot_set($_SESSION, 'messages', $messages);
                }
            }
    
            foreach ($headers as $header) {
                header($header);
            }
    
            header('Location: '.$destination, true, $status);
            exit;
        }
    
        /**
         * Creates a full url for the given parts.
         *
         * @param array|string $url
         * @param string       $route
         *
         * @return string
         */
        public function getUrl($url = [], $route = null)
        {
            $config = \Ilch\Registry::get('config');
    
            $modRewrite = false;
    
            if ($config !== null) {
                $modRewrite = (bool) $config->get('mod_rewrite');
            }
    
            if (empty($url)) {
                return BASE_URL;
            }
    
            if (is_string($url)) {
                return BASE_URL.'/index.php/'.$url;
            }
    
            $urlParts = [];
    
            if (!isset($url['module'])) {
                $urlParts[] = $this->request->getModuleName();
            } else {
                $urlParts[] = $url['module'];
                unset($url['module']);
            }
    
            if (!isset($url['controller'])) {
                $urlParts[] = $this->request->getControllerName();
            } else {
                $urlParts[] = $url['controller'];
                unset($url['controller']);
            }
    
            if (!isset($url['action'])) {
                $urlParts[] = $this->request->getActionName();
            } else {
                $urlParts[] = $url['action'];
                unset($url['action']);
            }
    
            foreach ($url as $key => $value) {
                $urlParts[] = $key.'/'.$value;
            }
    
            if ($this->request->isAdmin() && $route === null) {
                $route = "admin";
            }
    
            $prefix = '';
            
            if ($route !== null && $route !== 'frontend') {
                $prefix = $route. '/';
            }
    
            if ($modRewrite) {
                return BASE_URL.'/'.$prefix.implode('/', $urlParts);
            } else {
                return BASE_URL.'/index.php/'.$prefix.implode('/', $urlParts);
            }
        }
    }



    Zuletzt modifiziert von Slipi am 13.06.2018 - 10:48:30
    0 Mitglieder finden den Beitrag gut.
  3. #3
    User Pic
    blackcoder Entwickler
    Registriert seit
    22.05.2014
    Beiträge
    2.278
    Beitragswertungen
    356 Beitragspunkte
    Ist das hiermit behoben? Bitte einmal testen.

    github.com/IlchCMS/Ilch-2.0/commit/3a353a94fdf77aa3c27af1fc68216894a4ae682e

    function isEmailOnBlacklist($emailAddress)
    {
        if (empty($emailAddress)) {
            return false;
        }
        if (empty(trim(\Ilch\Registry::get('config')->get('emailBlacklist')))) {
            return false;
        }
        $emailBlacklist = explode(PHP_EOL, \Ilch\Registry::get('config')->get('emailBlacklist'));
        foreach ($emailBlacklist as $entry) {
            if (empty(trim($entry))) {
                continue;
            }
            if (strpos($emailAddress, trim($entry)) !== false) {
                return true;
            }
        }
        return false;
    }
    0 Mitglieder finden den Beitrag gut.
  4. #4
    User Pic
    Slipi ilch.de Design
    Registriert seit
    19.01.2018
    Beiträge
    938
    Beitragswertungen
    117 Beitragspunkte
    Hat funktioniert, jedoch bekam ich keine mail, obwohl Bestädigung per Link aktiviert wurde.
    Ich musste im Admincenter freischaltgen.

    Lg
    0 Mitglieder finden den Beitrag gut.
  5. #5
    User Pic
    blackcoder Entwickler
    Registriert seit
    22.05.2014
    Beiträge
    2.278
    Beitragswertungen
    356 Beitragspunkte
    Das hat andere Gründe. Mit den Änderungen oben wurden die beiden Warnungen behoben, die bei der Überprüfung "Ist E-Mail-Adresse in der Sperrliste?" aufgetreten sind.

    Danke für die Rückmeldung.
    1 Mitglieder finden den Beitrag gut.
Geschlossen

Zurück zu Fehlersuche und Probleme

Optionen: Bei einer Antwort zu diesem Thema eine eMail erhalten