Jump to content

Page "Clients" blanche ! :(


joept69

Recommended Posts

Bonjour à tous,

Depuis quelques jours, il m'est impossible d'afficher la page "Clients" > "Clients" dans le back office. La page "Adresses" quant à elle s'afficher et je peux accéder aux fiches clients individuellement mais la page "Clients" reste blanche, même après avoir vidé le cache...

Je n'ai fait aucune mise à jour, ni installé aucun module dernièrement. Je suis à court d'idée !

Je suis en PS 1.7.8.2 et PHP 7.4.25

PS : la boutique est en "maintenance" parce que l'activité n'est censée débutée que vers la mi-juin... (en principe).

Dans l'attente de votre aide, bonne soirée !

Joe

Link to comment
Share on other sites

Bonjour,
 

Le fichier "swift_required.php" dans le module de newsletter d'administration ne se charge pas.

Pouvez-vous s'il vous plaît nous envoyer une capture d'écran sur NewsMail.php.

Cette erreur peut entraîner la modification du chemin vers "swift_required.php"
 

Sincères amitiés,
Leo

Link to comment
Share on other sites

Bonjour Prestachamps,

Voici le code de NewsMail.php...

En attendant, merci pour votre attention. :)

<?php



if(version_compare(_PS_VERSION_, '1.6.1.5', '<')) {



	include_once(dirname(__FILE__).'/../../../tools/swift/Swift.php');

	include_once(dirname(__FILE__).'/../../../tools/swift/Swift/Connection/SMTP.php');

	include_once(dirname(__FILE__).'/../../../tools/swift/Swift/Connection/NativeMail.php');

	include_once(dirname(__FILE__).'/../../../tools/swift/Swift/Plugin/Decorator.php');

}

else {

	include_once(_PS_SWIFT_DIR_.'swift_required.php');

}



class NewsMail

{

	const TYPE_HTML = 1;

	const TYPE_TEXT = 2;

	const TYPE_BOTH = 3;



	public static function Send($id_lang, $template, $subject, $template_vars, $to,

		$to_name = null, $from = null, $from_name = null, $file_attachment = null, $mode_smtp = null,

		$template_path, $die = false, $id_shop = null, $bcc = null, $configuration = null)

	{

		if(!is_array($to)) {

			

			if (!self::validateEmail($to))

				return false;

		}

		

		if(version_compare(_PS_VERSION_, '1.6.1.5', '<')) {

		

			if($configuration == null) {

				$configuration = Configuration::getMultiple(array(

					'PS_SHOP_EMAIL',

					'PS_MAIL_METHOD',

					'PS_MAIL_SERVER',

					'PS_MAIL_USER',

					'PS_MAIL_PASSWD',

					'PS_SHOP_NAME',

					'NEWSLETTER_FORCE_PHP',

					'PS_MAIL_SMTP_ENCRYPTION',

					'PS_MAIL_SMTP_PORT',

					'PS_MAIL_TYPE',

					'PS_MAIL_DOMAIN'

				), null, null, $id_shop);

			}		



			if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']))

				$configuration['PS_MAIL_SMTP_ENCRYPTION'] = 'off';

			if (!isset($configuration['PS_MAIL_SMTP_PORT']))

				$configuration['PS_MAIL_SMTP_PORT'] = 'default';





			//Verify the Return-Path	

			if (!isset($address))

				$address = null;



			if (!is_array($template_vars))

				$template_vars = array();

			/* Construct multiple recipients list if needed */

			$to_list = new Swift_RecipientList();

			$to_plugin = $to;

			$to_list->addTo($to, $to_name);

			$to = $to_list;

			

			try {

				/* Connect with the appropriate configuration */

				

				if (empty($configuration['NEWSLETTER_FORCE_PHP']) && $configuration['PS_MAIL_METHOD'] == 2) {

				

					if (empty($configuration['PS_MAIL_SERVER']) || empty($configuration['PS_MAIL_SMTP_PORT']))

					{

						die('Error: invalid SMTP server or SMTP port');

					}

					$connection = new Swift_Connection_SMTP($configuration['PS_MAIL_SERVER'], $configuration['PS_MAIL_SMTP_PORT'],

						($configuration['PS_MAIL_SMTP_ENCRYPTION'] == 'ssl') ? Swift_Connection_SMTP::ENC_SSL :

						(($configuration['PS_MAIL_SMTP_ENCRYPTION'] == 'tls') ? Swift_Connection_SMTP::ENC_TLS : Swift_Connection_SMTP::ENC_OFF));

					$connection->setTimeout(4);

					if (!$connection)

						return false;

					if (!empty($configuration['PS_MAIL_USER']))

						$connection->setUsername($configuration['PS_MAIL_USER']);

					if (!empty($configuration['PS_MAIL_PASSWD']))

						$connection->setPassword($configuration['PS_MAIL_PASSWD']);

					

				}

				else

					$connection = new Swift_Connection_NativeMail();

				if (!$connection)

					return false;

				$swift = new Swift($connection, $configuration['PS_MAIL_DOMAIN']);

				/* Get templates content */

				$template_html = file_get_contents(dirname(__FILE__).'/../mails/newsletter.html');

				$template_txt = strip_tags(html_entity_decode(file_get_contents(dirname(__FILE__).'/../mails/newsletter.txt'), null, 'utf-8'));



				$message = new Swift_Message($subject);

				$message->setCharset('utf-8');

				/* Set Message-ID - getmypid() is blocked on some hosting */

				$message->setId(NewsMail::generateId());

				$message->headers->setEncoding('Q');

				$swift->attachPlugin(new Swift_Plugin_Decorator(array($to_plugin => $template_vars)), 'decorator');

				if ($configuration['PS_MAIL_TYPE'] == NewsMail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == NewsMail::TYPE_TEXT)

					$message->attach(new Swift_Message_Part($template_txt, 'text/plain', '8bit', 'utf-8'));

				if ($configuration['PS_MAIL_TYPE'] == NewsMail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == NewsMail::TYPE_HTML)

					$message->attach(new Swift_Message_Part($template_html, 'text/html', '8bit', 'utf-8'));

				/* Send mail */

				$send = $swift->send($message, $to, new Swift_Address($from, $from_name));

				$swift->disconnect();

				



				return $send;

			}

			catch (Swift_Exception $e) {

				echo $e;

				return false;

			}

		}

		else {



			$configuration = Configuration::getMultiple(array(

				'PS_SHOP_EMAIL',

				'PS_MAIL_METHOD',

				'PS_MAIL_SERVER',

				'PS_MAIL_USER',

				'PS_MAIL_PASSWD',

				'PS_SHOP_NAME',

				'NEWSLETTER_FORCE_PHP',

				'PS_MAIL_SMTP_ENCRYPTION',

				'PS_MAIL_SMTP_PORT',

				'PS_MAIL_TYPE'

			), null, null, $id_shop);



			if (!isset($configuration['PS_MAIL_SMTP_ENCRYPTION']) || Tools::strtolower($configuration['PS_MAIL_SMTP_ENCRYPTION']) === 'off') {



				$configuration['PS_MAIL_SMTP_ENCRYPTION'] = false;

			}

			if (!isset($configuration['PS_MAIL_SMTP_PORT'])) {

				$configuration['PS_MAIL_SMTP_PORT'] = 'default';

			}



			/* Construct multiple recipients list if needed */

			$message = Swift_Message::newInstance();

			$to_plugin = $to;

			$message->addTo($to, self::mimeEncode($to_name));

		

			/* Connect with the appropriate configuration */

			if (empty($configuration['NEWSLETTER_FORCE_PHP']) && $configuration['PS_MAIL_METHOD'] == 2) {

				if (empty($configuration['PS_MAIL_SERVER']) || empty($configuration['PS_MAIL_SMTP_PORT'])) {

					Tools::dieOrLog(Tools::displayError('Error: invalid SMTP server or SMTP port'), $die);

					return false;

				}



				$connection = Swift_SmtpTransport::newInstance($configuration['PS_MAIL_SERVER'], $configuration['PS_MAIL_SMTP_PORT'], $configuration['PS_MAIL_SMTP_ENCRYPTION'])

					->setUsername($configuration['PS_MAIL_USER'])

					->setPassword($configuration['PS_MAIL_PASSWD']);



			} else

				$connection = Swift_MailTransport::newInstance();

		

			if (!$connection) {

				return false;

			}

			$swift = Swift_Mailer::newInstance($connection);

			$logger = new Swift_Plugins_Loggers_EchoLogger();

			$swift->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));

			/* Get templates content */           

			$template_html = file_get_contents(dirname(__FILE__).'/../mails/newsletter.html');

			$template_txt = strip_tags(html_entity_decode(file_get_contents(dirname(__FILE__).'/../mails/newsletter.txt'), null, 'utf-8'));



			$message->setSubject($subject);

			$message->setCharset('utf-8');



			/* Set Message-ID - getmypid() is blocked on some hosting */

			$message->setId(NewsMail::generateId());			

			$swift->registerPlugin(new Swift_Plugins_DecoratorPlugin(array($to_plugin => $template_vars)));

			if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_TEXT) {

				$message->addPart($template_txt, 'text/plain', 'utf-8');

			}

			if ($configuration['PS_MAIL_TYPE'] == Mail::TYPE_BOTH || $configuration['PS_MAIL_TYPE'] == Mail::TYPE_HTML) {

				$message->addPart($template_html, 'text/html', 'utf-8');

			}



			/* Send mail */

			$message->setFrom(array($from => $from_name));

			if($swift->send($message))

				return true;

			else

				d($logger->dump());			

		}		

	}



	/* Rewrite of Swift_Message::generateId() without getmypid() */

	protected static function generateId($idstring = null)

	{

		$midparams =  array(

			'utctime' => gmstrftime('%Y%m%d%H%M%S'),

			'randint' => mt_rand(),

			'customstr' => (preg_match('/^(?<!\\.)[a-z0-9\\.]+(?!\\.)\$/iD', $idstring) ? $idstring : 'swift') ,

			'hostname' => (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : php_uname('n')),

		);

		$pattern = version_compare(_PS_VERSION_, '1.6.1.5', '<') ? '<%s.%d.%s@%s>' : '%s.%d.%s@%s';

		return vsprintf($pattern, $midparams);

	}



	public static function validateEmail($mail)

	{

		$user   = '[a-zA-Z0-9_\-\.\+\^!#\$%&*+\/\=\?\`\|\{\}~\']+';

		$domain = '(?:(?:[a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.?)+';

		$ipv4   = '[0-9]{1,3}(\.[0-9]{1,3}){3}';

		$ipv6   = '[0-9a-fA-F]{1,4}(\:[0-9a-fA-F]{1,4}){7}';



		return preg_match("/^$user@($domain|(\[($ipv4|$ipv6)\]))$/", $mail);

	}

	

    /**

     * Check if a multibyte character set is used for the data

     *

     * @param string $data Data

     * @return bool Whether the string uses a multibyte character set

     */

    public static function isMultibyte($data)

    {

        $length = Tools::strlen($data);

        for ($i = 0; $i < $length; $i++) {

            if (ord(($data[$i])) > 128) {

                return true;

            }

        }

        return false;

    }	

    /**

     * MIME encode the string

     *

     * @param string $string The string to encode

     * @param string $charset The character set to use

     * @param string $newline The newline character(s)

     * @return mixed|string MIME encoded string

     */

    public static function mimeEncode($string, $charset = 'UTF-8', $newline = "\r\n")

    {

        if (!self::isMultibyte($string) && Tools::strlen($string) < 75) {

            return $string;

        }



        $charset = Tools::strtoupper($charset);

        $start = '=?'.$charset.'?B?';

        $end = '?=';

        $sep = $end.$newline.' '.$start;

        $length = 75 - Tools::strlen($start) - Tools::strlen($end);

        $length = $length - ($length % 4);



        if ($charset === 'UTF-8') {

            $parts = array();

            $maxchars = floor(($length * 3) / 4);

            $stringLength = Tools::strlen($string);



            while ($stringLength > $maxchars) {

                $i = (int)$maxchars;

                $result = ord($string[$i]);



                while ($result >= 128 && $result <= 191) {

                    $result = ord($string[--$i]);

                }



                $parts[] = base64_encode(Tools::substr($string, 0, $i));

                $string = Tools::substr($string, $i);

                $stringLength = Tools::strlen($string);

            }



            $parts[] = base64_encode($string);

            $string = implode($sep, $parts);

        } 

		else {

            $string = chunk_split(base64_encode($string), $length, $sep);

            $string = preg_replace('/'.preg_quote($sep).'$/', '', $string);

        }



        return $start.$string.$end;

    }

}

 

Link to comment
Share on other sites

Vérifiez si le dossier swiftmail / root / vendor / swiftmailer / swiftmailer existe

et s'il existe, alors dans le dossier lib, il doit y avoir un fichier swift_required.php qui est probablement manquant et c'est pourquoi cette erreur se produit.

S'il n'y est pas, téléchargez un nouveau prestashop de la même version que vous utilisez et copiez simplement le fichier swift_required.php.

Sincères amitiés,
Leo

Link to comment
Share on other sites

Il y a 21 heures, Prestachamps a dit :

Vérifiez si le dossier swiftmail / root / vendor / swiftmailer / swiftmailer existe

et s'il existe, alors dans le dossier lib, il doit y avoir un fichier swift_required.php qui est probablement manquant et c'est pourquoi cette erreur se produit.

S'il n'y est pas, téléchargez un nouveau prestashop de la même version que vous utilisez et copiez simplement le fichier swift_required.php.

Sincères amitiés,
Leo

Bonjour Léo et merci pour votre attention.

Après vérification,  /www/shop/vendor/swiftmailer/swiftmailer/lib : le fichier swift_required.php est bien présent et la date du fichier est celle du jour de l'installation de Prestashop 1.7.8.2 sur mon site. J'ai essayé de remplacer le fichier sur le serveur par celui de l'installation Prestashop... mais ça n'a rien changé.

Je ne sais pas quoi faire d'autre...

En attendant merci et bonne journée.

 

Link to comment
Share on other sites

il y a 9 minutes, Mediacom87 a dit :

Le module semble appelé les fichiers concernant la version .6 et non pas la version 1.7 ce qui est assez étrange.

Bon... ben ça dépasse mes compétences pour résoudre le problème...

Du coup, je me suis dit que j'allais mettre à jour et espérer un miracle et là ...

1653910864_FireShotCapture019-1-ClickUpgrade1-ClickUpgradeTourmentinePortoDeQuintas_-tourmentine_fr.thumb.png.22fca7c484b5638a726239de157e6460.png

 

Voilà qui tranche définitivement sur l'option "mise à jour"... Je précise que le "Cache" est bien activé dans les "Paramètres Avancés / Performances"...

 

Edited by joept69 (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...