Merge branch 'master' of github.com:Mibew/mibew

This commit is contained in:
Fedor A. Fetisov 2017-11-01 04:26:24 +03:00
commit 9cd07fe829
7 changed files with 26 additions and 13 deletions

View File

@ -80,6 +80,15 @@ chat_user_popup_style:
requirements: requirements:
style: "[0-9A-Za-z_]*" style: "[0-9A-Za-z_]*"
chat_user_popup_style_force_secure:
path: /chat/style/popup/{style}/force_secure
defaults:
_controller: Mibew\Controller\Chat\StyleController::loadPopupStyleAction
style: ""
force_secure: on
requirements:
style: "[0-9A-Za-z_]*"
chat_user_start: chat_user_start:
path: /chat path: /chat
defaults: defaults:

View File

@ -20,4 +20,4 @@
// Force the user to specify the entry point. This should be done only when // Force the user to specify the entry point. This should be done only when
// mod_rewrite is not used by apache. // mod_rewrite is not used by apache.
header('HTTP/1.0 301 Moved Permanently'); header('HTTP/1.0 301 Moved Permanently');
header('Location: index.php/'); header('Location: index.php');

View File

@ -189,7 +189,7 @@ function setup_leavemessage($name, $email, $group_id, $info, $referrer)
} }
/** /**
* Prepare data to dispaly pre-chat survey * Prepare data to display pre-chat survey
* *
* @param string $name User name * @param string $name User name
* @param string $email User email * @param string $email User email

View File

@ -187,7 +187,7 @@ abstract class AbstractGenerator implements GeneratorInterface
$style_name = $this->getOption('chat_style'); $style_name = $this->getOption('chat_style');
if (!$style_name) { if (!$style_name) {
return $defaults + array( return $defaults + array(
'styleLoader' => $this->generateUrl('chat_user_popup_style'), 'styleLoader' => $this->generateUrl($this->getOption('force_secure') ? 'chat_user_popup_style_force_secure' : 'chat_user_popup_style'), // An ugly way to solve the architecture issue
); );
} }
@ -201,7 +201,7 @@ abstract class AbstractGenerator implements GeneratorInterface
$defaults $defaults
) + array( ) + array(
'styleLoader' => $this->generateUrl( 'styleLoader' => $this->generateUrl(
'chat_user_popup_style', $this->getOption('force_secure') ? 'chat_user_popup_style_force_secure' : 'chat_user_popup_style', // An ugly way to solve the architecture issue
array('style' => $style_name) array('style' => $style_name)
), ),
); );
@ -219,6 +219,7 @@ abstract class AbstractGenerator implements GeneratorInterface
'url' => $this->getChatUrl(), 'url' => $this->getChatUrl(),
'preferIFrame' => $this->getOption('prefer_iframe'), 'preferIFrame' => $this->getOption('prefer_iframe'),
'modSecurity' => $this->getOption('mod_security'), 'modSecurity' => $this->getOption('mod_security'),
'forceSecure' => $this->getOption('force_secure'),
) + $this->getPopupStyle(); ) + $this->getPopupStyle();
} }

View File

@ -48,10 +48,15 @@ class StyleController extends AbstractController
$response = new JsonResponse(); $response = new JsonResponse();
if ($configs['chat']['iframe']['css']) { if ($configs['chat']['iframe']['css']) {
$generator = $this->getAssetManager()->getUrlGenerator(); $generator = $this->getAssetManager()->getUrlGenerator();
$css = $generator->generate( $css = $request->attributes->get('force_secure') ?
$style->getFilesPath() . '/' . $configs['chat']['iframe']['css'], $generator->generateSecure(
UrlGeneratorInterface::ABSOLUTE_URL $style->getFilesPath() . '/' . $configs['chat']['iframe']['css'],
); UrlGeneratorInterface::ABSOLUTE_URL
) :
$generator->generate(
$style->getFilesPath() . '/' . $configs['chat']['iframe']['css'],
UrlGeneratorInterface::ABSOLUTE_URL
);
$response->setData($css); $response->setData($css);
$response->setCallback('Mibew.Utils.loadStyleSheet'); $response->setCallback('Mibew.Utils.loadStyleSheet');
} }

View File

@ -49,7 +49,7 @@ class Utils
); );
$plugin_files = glob($pattern); $plugin_files = glob($pattern);
if ($plugin_files === FALSE) { if ($plugin_files === false) {
// TODO: Maybe one should raise some exception here // TODO: Maybe one should raise some exception here
return $plugins; return $plugins;
} }

View File

@ -52,7 +52,6 @@ function get_by_date_statistics($start, $end)
. "FROM {threadstatistics} s " . "FROM {threadstatistics} s "
. "WHERE s.date >= :start " . "WHERE s.date >= :start "
. "AND s.date < :end " . "AND s.date < :end "
. "GROUP BY DATE(FROM_UNIXTIME(date)) "
. "ORDER BY s.date DESC"), . "ORDER BY s.date DESC"),
array( array(
':start' => $start, ':start' => $start,
@ -63,8 +62,7 @@ function get_by_date_statistics($start, $end)
// Get statistics aggregated for all accessed interval // Get statistics aggregated for all accessed interval
$total = $db->query( $total = $db->query(
("SELECT DATE(FROM_UNIXTIME(date)) AS date, " ("SELECT SUM(threads) AS threads, "
. "SUM(threads) AS threads, "
. "SUM(missedthreads) AS missedthreads, " . "SUM(missedthreads) AS missedthreads, "
. "SUM(sentinvitations) AS sentinvitations, " . "SUM(sentinvitations) AS sentinvitations, "
. "SUM(acceptedinvitations) AS acceptedinvitations, " . "SUM(acceptedinvitations) AS acceptedinvitations, "
@ -116,7 +114,7 @@ function get_by_operator_statistics($start, $end)
. "WHERE s.operatorid = o.operatorid " . "WHERE s.operatorid = o.operatorid "
. "AND s.date >= :start " . "AND s.date >= :start "
. "AND s.date < :end " . "AND s.date < :end "
. "GROUP BY s.operatorid"), . "GROUP BY s.operatorid, o.vclocalename"),
array( array(
':start' => $start, ':start' => $start,
':end' => $end, ':end' => $end,