mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-01 05:44:41 +03:00
Group all dialogs related functions in ChatStyle class
This commit is contained in:
parent
d406f720d8
commit
4c51930c25
@ -24,6 +24,9 @@ require_once(dirname(__FILE__).'/libs/captcha.php');
|
|||||||
require_once(dirname(__FILE__).'/libs/invitation.php');
|
require_once(dirname(__FILE__).'/libs/invitation.php');
|
||||||
require_once(dirname(__FILE__).'/libs/track.php');
|
require_once(dirname(__FILE__).'/libs/track.php');
|
||||||
require_once(dirname(__FILE__).'/libs/classes/thread.php');
|
require_once(dirname(__FILE__).'/libs/classes/thread.php');
|
||||||
|
require_once(dirname(__FILE__).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(__FILE__).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(__FILE__).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
if(Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
|
if(Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
|
||||||
if(!is_secure_request()) {
|
if(!is_secure_request()) {
|
||||||
@ -37,6 +40,8 @@ if(Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize chat style which is currently used in system
|
||||||
|
$chat_style = new ChatStyle(ChatStyle::currentStyle());
|
||||||
|
|
||||||
// Do not support old browsers at all
|
// Do not support old browsers at all
|
||||||
if (get_remote_level($_SERVER['HTTP_USER_AGENT']) == 'old') {
|
if (get_remote_level($_SERVER['HTTP_USER_AGENT']) == 'old') {
|
||||||
@ -44,7 +49,7 @@ if (get_remote_level($_SERVER['HTTP_USER_AGENT']) == 'old') {
|
|||||||
$page = array_merge_recursive(
|
$page = array_merge_recursive(
|
||||||
setup_logo()
|
setup_logo()
|
||||||
);
|
);
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "nochat.tpl");
|
$chat_style->render('nochat');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +68,7 @@ if (verifyparam("act", "/^(invitation)$/", "default") == 'invitation'
|
|||||||
// Build js application options
|
// Build js application options
|
||||||
$page['invitationOptions'] = json_encode($page['invitation']);
|
$page['invitationOptions'] = json_encode($page['invitation']);
|
||||||
// Expand page
|
// Expand page
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "chat.tpl");
|
$chat_style->render('chat');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -129,7 +134,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
$page['leaveMessageOptions'] = json_encode($page['leaveMessage']);
|
$page['leaveMessageOptions'] = json_encode($page['leaveMessage']);
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "chat.tpl");
|
$chat_style->render('chat');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +163,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
|||||||
setup_survey($visitor['name'], $email, $groupid, $info, $referrer)
|
setup_survey($visitor['name'], $email, $groupid, $info, $referrer)
|
||||||
);
|
);
|
||||||
$page['surveyOptions'] = json_encode($page['survey']);
|
$page['surveyOptions'] = json_encode($page['survey']);
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "chat.tpl");
|
$chat_style->render('chat');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,12 +189,12 @@ $page = setup_chatview_for_user($thread);
|
|||||||
|
|
||||||
$pparam = verifyparam( "act", "/^(mailthread)$/", "default");
|
$pparam = verifyparam( "act", "/^(mailthread)$/", "default");
|
||||||
if( $pparam == "mailthread" ) {
|
if( $pparam == "mailthread" ) {
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "mail.tpl");
|
$chat_style->render('mail');
|
||||||
} else {
|
} else {
|
||||||
// Build js application options
|
// Build js application options
|
||||||
$page['chatOptions'] = json_encode($page['chat']);
|
$page['chatOptions'] = json_encode($page['chat']);
|
||||||
// Expand page
|
// Expand page
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "chat.tpl");
|
$chat_style->render('chat');
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -24,6 +24,9 @@ require_once(dirname(__FILE__).'/classes/mibew_api_execution_context.php');
|
|||||||
require_once(dirname(__FILE__).'/classes/request_processor.php');
|
require_once(dirname(__FILE__).'/classes/request_processor.php');
|
||||||
require_once(dirname(__FILE__).'/classes/client_side_processor.php');
|
require_once(dirname(__FILE__).'/classes/client_side_processor.php');
|
||||||
require_once(dirname(__FILE__).'/classes/thread_processor.php');
|
require_once(dirname(__FILE__).'/classes/thread_processor.php');
|
||||||
|
require_once(dirname(__FILE__).'/interfaces/style.php');
|
||||||
|
require_once(dirname(__FILE__).'/classes/style.php');
|
||||||
|
require_once(dirname(__FILE__).'/classes/chat_style.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -418,7 +421,8 @@ function setup_chatview(Thread $thread) {
|
|||||||
$data['neediframesrc'] = needsFramesrc();
|
$data['neediframesrc'] = needsFramesrc();
|
||||||
|
|
||||||
// Load dialogs style options
|
// Load dialogs style options
|
||||||
$style_config = get_dialogs_style_config(getchatstyle());
|
$chat_style = new ChatStyle(ChatStyle::currentStyle());
|
||||||
|
$style_config = $chat_style->configurations();
|
||||||
$data['chat']['windowsParams']['mail']
|
$data['chat']['windowsParams']['mail']
|
||||||
= $style_config['mail']['window_params'];
|
= $style_config['mail']['window_params'];
|
||||||
|
|
||||||
|
129
src/mibew/libs/classes/chat_style.php
Normal file
129
src/mibew/libs/classes/chat_style.php
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2013 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a chat style
|
||||||
|
*/
|
||||||
|
class ChatStyle extends Style implements StyleInterface {
|
||||||
|
/**
|
||||||
|
* Builds base path for style files. This path is relative Mibew root and
|
||||||
|
* does not contain neither leading nor trailing slash.
|
||||||
|
*
|
||||||
|
* @return string Base path for style files
|
||||||
|
*/
|
||||||
|
public function filesPath() {
|
||||||
|
return 'styles/dialogs/' . $this->name();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders template file to HTML and send it to the output
|
||||||
|
*
|
||||||
|
* @param string $template_name Name of the template file without path and
|
||||||
|
* extension
|
||||||
|
*/
|
||||||
|
public function render($template_name) {
|
||||||
|
$templates_root = dirname(dirname(dirname(__FILE__))) .
|
||||||
|
'/' . $this->filesPath() . '/templates/';
|
||||||
|
$full_template_name = $template_name . '.tpl';
|
||||||
|
|
||||||
|
expand($this, $templates_root, $full_template_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns name of the style which is currently used in the system
|
||||||
|
*
|
||||||
|
* @return string Name of a style
|
||||||
|
*/
|
||||||
|
public static function currentStyle() {
|
||||||
|
// Ceck if request contains chat style
|
||||||
|
$style_name = verifyparam("style", "/^\w+$/", "");
|
||||||
|
if (!$style_name) {
|
||||||
|
// Load value from system settings
|
||||||
|
$style_name = Settings::get('chat_style');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all style list and make sure that in has at least one style.
|
||||||
|
$available_styles = self::availableStyles();
|
||||||
|
if (empty($available_styles)) {
|
||||||
|
throw new RuntimeException('There are no dialog styles in the system');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if selected style exists. If it does not exist try to fall back
|
||||||
|
// to "default". Finally, if there is no appropriate style in the system
|
||||||
|
// throw an exception.
|
||||||
|
if (in_array($style_name, $available_styles)) {
|
||||||
|
return $style_name;
|
||||||
|
} elseif (in_array('default', $available_styles)) {
|
||||||
|
return 'default';
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException('There is no appropriate dialog style in the system');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets style which is currently used in the system
|
||||||
|
*
|
||||||
|
* @param string $style_name Name of a style
|
||||||
|
*/
|
||||||
|
public static function setCurrentStyle($style_name) {
|
||||||
|
Settings::set('chat_style', $style_name);
|
||||||
|
Settings::update();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array which contains names of available styles.
|
||||||
|
*
|
||||||
|
* @param array List of styles names
|
||||||
|
*/
|
||||||
|
public static function availableStyles() {
|
||||||
|
$styles_root = dirname(dirname(dirname(__FILE__))) .
|
||||||
|
'/styles/dialogs';
|
||||||
|
|
||||||
|
return self::getStyleList($styles_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns array of default configurations for concrete style object. This
|
||||||
|
* method uses "Template method" design pattern.
|
||||||
|
*
|
||||||
|
* @return array Default configurations of the style
|
||||||
|
*/
|
||||||
|
protected function defaultConfigurations() {
|
||||||
|
return array(
|
||||||
|
'history' => array(
|
||||||
|
'window_params' => ''
|
||||||
|
),
|
||||||
|
'users' => array(
|
||||||
|
'thread_tag' => 'div',
|
||||||
|
'visitor_tag' => 'div'
|
||||||
|
),
|
||||||
|
'tracked' => array(
|
||||||
|
'user_window_params' => '',
|
||||||
|
'visitor_window_params' => ''
|
||||||
|
),
|
||||||
|
'invitation' => array(
|
||||||
|
'window_params' => ''
|
||||||
|
),
|
||||||
|
'ban' => array(
|
||||||
|
'window_params' => ''
|
||||||
|
),
|
||||||
|
'screenshots' => array()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -65,7 +65,7 @@ Class Settings {
|
|||||||
'hosturl' => 'http://mibew.org',
|
'hosturl' => 'http://mibew.org',
|
||||||
'logo' => '',
|
'logo' => '',
|
||||||
'usernamepattern' => '{name}',
|
'usernamepattern' => '{name}',
|
||||||
'chatstyle' => 'default',
|
'chat_style' => 'default',
|
||||||
'invitationstyle' => 'default',
|
'invitationstyle' => 'default',
|
||||||
'operator_pages_style' => 'default',
|
'operator_pages_style' => 'default',
|
||||||
'chattitle' => 'Live Support',
|
'chattitle' => 'Live Support',
|
||||||
|
135
src/mibew/libs/classes/style.php
Normal file
135
src/mibew/libs/classes/style.php
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2013 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for styles
|
||||||
|
*/
|
||||||
|
abstract class Style {
|
||||||
|
/**
|
||||||
|
* Styles configuration array or NULL by default
|
||||||
|
* @var array|NULL
|
||||||
|
*/
|
||||||
|
protected $cachedConfigurations = NULL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This value is used to store name of a style
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $styleName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains cached results of the Style::getStyleList method. The lists are
|
||||||
|
* keyed by the $root_dir argument of the method.
|
||||||
|
* @var array
|
||||||
|
* @see Style::getStyleList
|
||||||
|
*/
|
||||||
|
protected static $cachedStyleLists = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Object constructor
|
||||||
|
*
|
||||||
|
* @param string $style_name Name of the style
|
||||||
|
*/
|
||||||
|
public function __construct($style_name) {
|
||||||
|
$this->styleName = $style_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns name of the style related with the object
|
||||||
|
*
|
||||||
|
* @return string Name of the style
|
||||||
|
*/
|
||||||
|
public function name() {
|
||||||
|
return $this->styleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads configurations of the style. The results is cached in the class
|
||||||
|
* instance.
|
||||||
|
*
|
||||||
|
* @return array Style configurations
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
|
public function configurations() {
|
||||||
|
$config_file = dirname(dirname(dirname(__FILE__)))
|
||||||
|
. '/' . $this->filesPath() . '/config.ini';
|
||||||
|
|
||||||
|
// Check if configurations already loaded. Do not do the job twice.
|
||||||
|
if (is_null($this->cachedConfigurations)) {
|
||||||
|
// Set empty value for configuration array
|
||||||
|
$this->cachedConfigurations = array();
|
||||||
|
|
||||||
|
// Try to read configuration file
|
||||||
|
if (!is_readable($config_file)) {
|
||||||
|
throw new RuntimeException('Cannot read configuration file');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load configurations from file, merge it with default configs and
|
||||||
|
// cache the result.
|
||||||
|
$loaded_config = parse_ini_file($config_file, true);
|
||||||
|
$default_config = $this->defaultConfigurations();
|
||||||
|
$this->cachedConfigurations = $loaded_config + $default_config;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->cachedConfigurations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets names of styles which are located in the $root_dir.
|
||||||
|
*
|
||||||
|
* @param string $root_dir Root styles directory
|
||||||
|
* @return array List of styles' names
|
||||||
|
*/
|
||||||
|
protected static function getStyleList($root_dir) {
|
||||||
|
// Check if styles list is already stored in the cache
|
||||||
|
if (!isset(self::$cachedStyleLists[$root_dir])) {
|
||||||
|
// Build list of styles for the specified root directory.
|
||||||
|
$style_list = array();
|
||||||
|
if ($handle = opendir($root_dir)) {
|
||||||
|
while (false !== ($file = readdir($handle))) {
|
||||||
|
if (preg_match("/^\w+$/", $file) && is_dir("$root_dir/$file")) {
|
||||||
|
$style_list[$file] = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache the list
|
||||||
|
self::$cachedStyleLists[$root_dir] = $style_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$cachedStyleLists[$root_dir];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds base path for style files. This path is relative Mibew root and
|
||||||
|
* does not contain neither leading nor trailing slash.
|
||||||
|
*
|
||||||
|
* @return string Base path for style files
|
||||||
|
*/
|
||||||
|
public abstract function filesPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns array of default configurations for concrete style object. This
|
||||||
|
* method uses "Template method" design pattern.
|
||||||
|
*
|
||||||
|
* @return array Default configurations of the style
|
||||||
|
*/
|
||||||
|
protected abstract function defaultConfigurations();
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -67,32 +67,4 @@ function get_core_style_config($style) {
|
|||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Load configuration array for dialogs style
|
|
||||||
*
|
|
||||||
* @param string $style Style name
|
|
||||||
* @return array Configuration array
|
|
||||||
*/
|
|
||||||
function get_dialogs_style_config($style) {
|
|
||||||
// Get root dir of mibew messanger
|
|
||||||
$base_path = realpath(dirname(dirname(dirname(__FILE__))));
|
|
||||||
|
|
||||||
// Load config
|
|
||||||
$config = read_config_file($base_path.'/styles/dialogs/'.$style.'/config.ini');
|
|
||||||
|
|
||||||
// Set default values
|
|
||||||
$config = ($config === false) ? array() : $config;
|
|
||||||
$config += array(
|
|
||||||
'chat' => array(
|
|
||||||
'window_params' => ''
|
|
||||||
),
|
|
||||||
'mail' => array(
|
|
||||||
'window_params' => ''
|
|
||||||
),
|
|
||||||
'screenshots' => array()
|
|
||||||
);
|
|
||||||
|
|
||||||
return $config;
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -76,15 +76,6 @@ function is_secure_request()
|
|||||||
|| isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on";
|
|| isset($_SERVER["HTTP_HTTPS"]) && $_SERVER["HTTP_HTTPS"] == "on";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getchatstyle()
|
|
||||||
{
|
|
||||||
$chatstyle = verifyparam("style", "/^\w+$/", "");
|
|
||||||
if ($chatstyle) {
|
|
||||||
return $chatstyle;
|
|
||||||
}
|
|
||||||
return Settings::get('chatstyle');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns name of the current operator pages style
|
* Returns name of the current operator pages style
|
||||||
*
|
*
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
$ifregexp = "/\\\${(if|ifnot):([\w\.]+)}(.*?)(\\\${else:\\2}.*?)?\\\${endif:\\2}/s";
|
$ifregexp = "/\\\${(if|ifnot):([\w\.]+)}(.*?)(\\\${else:\\2}.*?)?\\\${endif:\\2}/s";
|
||||||
$expand_include_path = "";
|
$expand_include_path = "";
|
||||||
$current_style = "";
|
$current_style = NULL;
|
||||||
$flatten_page = array();
|
$flatten_page = array();
|
||||||
|
|
||||||
|
|
||||||
@ -52,9 +52,9 @@ function expand_var($matches)
|
|||||||
if ($var == 'mibewroot') {
|
if ($var == 'mibewroot') {
|
||||||
return $mibewroot;
|
return $mibewroot;
|
||||||
} else if ($var == 'tplroot') {
|
} else if ($var == 'tplroot') {
|
||||||
return "$mibewroot/styles/dialogs/$current_style";
|
return "$mibewroot/" . $current_style->filesPath();
|
||||||
} else if ($var == 'styleid') {
|
} else if ($var == 'styleid') {
|
||||||
return $current_style;
|
return $current_style->name();
|
||||||
} else if ($var == 'pagination') {
|
} else if ($var == 'pagination') {
|
||||||
return generate_pagination($page['pagination']);
|
return generate_pagination($page['pagination']);
|
||||||
} else if ($var == 'errors' || $var == 'harderrors') {
|
} else if ($var == 'errors' || $var == 'harderrors') {
|
||||||
@ -110,24 +110,16 @@ function expandtext($text)
|
|||||||
return preg_replace_callback("/\\\${(\w+:)?([\w\.,]+)}/", "expand_var", $text);
|
return preg_replace_callback("/\\\${(\w+:)?([\w\.,]+)}/", "expand_var", $text);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expand($basedir, $style, $filename)
|
function expand(StyleInterface $style, $templates_root, $filename)
|
||||||
{
|
{
|
||||||
global $page, $expand_include_path, $current_style, $flatten_page;
|
global $page, $expand_include_path, $current_style, $flatten_page;
|
||||||
|
|
||||||
$flatten_page = array_flatten_recursive($page);
|
$flatten_page = array_flatten_recursive($page);
|
||||||
|
|
||||||
start_html_output();
|
start_html_output();
|
||||||
if (!is_dir("$basedir/$style")) {
|
$expand_include_path = $templates_root;
|
||||||
$style = "default";
|
|
||||||
}
|
|
||||||
$expand_include_path = "$basedir/$style/templates/";
|
|
||||||
$current_style = $style;
|
$current_style = $style;
|
||||||
$contents = @file_get_contents($expand_include_path . $filename);
|
$contents = @file_get_contents($expand_include_path . $filename);
|
||||||
if ($contents === false) {
|
|
||||||
$expand_include_path = "$basedir/default/templates/";
|
|
||||||
$current_style = "default";
|
|
||||||
$contents = @file_get_contents($expand_include_path . $filename) or die("cannot load template");
|
|
||||||
}
|
|
||||||
echo expandtext($contents);
|
echo expandtext($contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
74
src/mibew/libs/interfaces/style.php
Normal file
74
src/mibew/libs/interfaces/style.php
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright 2005-2013 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine interface for specific style class.
|
||||||
|
*/
|
||||||
|
interface StyleInterface {
|
||||||
|
/**
|
||||||
|
* Returns name of the style which is currently used in the system
|
||||||
|
*
|
||||||
|
* @return string Name of a style
|
||||||
|
*/
|
||||||
|
public static function currentStyle();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets style which is currently used in the system
|
||||||
|
*
|
||||||
|
* @param string $style_name Name of a style
|
||||||
|
*/
|
||||||
|
public static function setCurrentStyle($style_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns an array which contains names of available styles.
|
||||||
|
*
|
||||||
|
* @param array List of styles names
|
||||||
|
*/
|
||||||
|
public static function availableStyles();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds base path for style files. This URL is relative Mibew root and
|
||||||
|
* does not contain neither leading nor trailing slash.
|
||||||
|
*
|
||||||
|
* @return string Base path for style files
|
||||||
|
*/
|
||||||
|
public function filesPath();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads and returns configurations of the style.
|
||||||
|
*
|
||||||
|
* @param array $name Style's configuration params
|
||||||
|
*/
|
||||||
|
public function configurations();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns name of the style related with the object
|
||||||
|
*
|
||||||
|
* @return string Name of the style
|
||||||
|
*/
|
||||||
|
public function name();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders template file to HTML and send it to the output
|
||||||
|
*
|
||||||
|
* @param string $template_name Name of the template file without path and
|
||||||
|
* extension.
|
||||||
|
*/
|
||||||
|
public function render($template_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -21,6 +21,9 @@ require_once(dirname(__FILE__).'/libs/expand.php');
|
|||||||
require_once(dirname(__FILE__).'/libs/groups.php');
|
require_once(dirname(__FILE__).'/libs/groups.php');
|
||||||
require_once(dirname(__FILE__).'/libs/notify.php');
|
require_once(dirname(__FILE__).'/libs/notify.php');
|
||||||
require_once(dirname(__FILE__).'/libs/classes/thread.php');
|
require_once(dirname(__FILE__).'/libs/classes/thread.php');
|
||||||
|
require_once(dirname(__FILE__).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(__FILE__).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(__FILE__).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
$page = array();
|
$page = array();
|
||||||
@ -33,6 +36,9 @@ if (! $thread) {
|
|||||||
die("wrong thread");
|
die("wrong thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize chat style which is currently used in system
|
||||||
|
$chat_style = new ChatStyle(ChatStyle::currentStyle());
|
||||||
|
|
||||||
$email = getparam('email');
|
$email = getparam('email');
|
||||||
$page['email'] = $email;
|
$page['email'] = $email;
|
||||||
$group = is_null($thread->groupId)?NULL:group_by_id($thread->groupId);
|
$group = is_null($thread->groupId)?NULL:group_by_id($thread->groupId);
|
||||||
@ -51,7 +57,7 @@ if( count($errors) > 0 ) {
|
|||||||
$page,
|
$page,
|
||||||
setup_logo($group)
|
setup_logo($group)
|
||||||
);
|
);
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "mail.tpl");
|
$chat_style->render('mail');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,6 +80,6 @@ $page = array_merge_recursive(
|
|||||||
$page,
|
$page,
|
||||||
setup_logo($group)
|
setup_logo($group)
|
||||||
);
|
);
|
||||||
expand(dirname(__FILE__).'/styles/dialogs', getchatstyle(), "mailsent.tpl");
|
$chat_style->render('mailsent');
|
||||||
exit;
|
exit;
|
||||||
?>
|
?>
|
@ -24,6 +24,9 @@ require_once(dirname(dirname(__FILE__)).'/libs/pagination.php');
|
|||||||
require_once(dirname(dirname(__FILE__)).'/libs/expand.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/expand.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/classes/thread.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/thread.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
|
|
||||||
@ -42,21 +45,22 @@ if (Settings::get('enablessl') == "1" && Settings::get('forcessl') == "1") {
|
|||||||
$threadid = verifyparam("thread", "/^\d{1,8}$/");
|
$threadid = verifyparam("thread", "/^\d{1,8}$/");
|
||||||
$page = array();
|
$page = array();
|
||||||
|
|
||||||
|
// Initialize chat style which is currently used in system
|
||||||
|
$chat_style = new ChatStyle(ChatStyle::currentStyle());
|
||||||
|
|
||||||
if (!isset($_GET['token'])) {
|
if (!isset($_GET['token'])) {
|
||||||
|
|
||||||
$remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
|
$remote_level = get_remote_level($_SERVER['HTTP_USER_AGENT']);
|
||||||
if ($remote_level != "ajaxed") {
|
if ($remote_level != "ajaxed") {
|
||||||
$errors = array(getlocal("thread.error.old_browser"));
|
$errors = array(getlocal("thread.error.old_browser"));
|
||||||
start_html_output();
|
$chat_style->render('error');
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$thread = Thread::load($threadid);
|
$thread = Thread::load($threadid);
|
||||||
if (!$thread || !isset($thread->lastToken)) {
|
if (!$thread || !isset($thread->lastToken)) {
|
||||||
$errors = array(getlocal("thread.error.wrong_thread"));
|
$errors = array(getlocal("thread.error.wrong_thread"));
|
||||||
start_html_output();
|
$chat_style->render('error');
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,8 +71,7 @@ if (!isset($_GET['token'])) {
|
|||||||
|
|
||||||
if (!is_capable(CAN_TAKEOVER, $operator)) {
|
if (!is_capable(CAN_TAKEOVER, $operator)) {
|
||||||
$errors = array(getlocal("thread.error.cannot_take_over"));
|
$errors = array(getlocal("thread.error.cannot_take_over"));
|
||||||
start_html_output();
|
$chat_style->render('error');
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,14 +89,12 @@ if (!isset($_GET['token'])) {
|
|||||||
if (!$viewonly) {
|
if (!$viewonly) {
|
||||||
if(! $thread->take($operator)){
|
if(! $thread->take($operator)){
|
||||||
$errors = array(getlocal("thread.error.cannot_take"));
|
$errors = array(getlocal("thread.error.cannot_take"));
|
||||||
start_html_output();
|
$chat_style->render('error');
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
} else if (!is_capable(CAN_VIEWTHREADS, $operator)) {
|
} else if (!is_capable(CAN_VIEWTHREADS, $operator)) {
|
||||||
$errors = array(getlocal("thread.error.cannot_view"));
|
$errors = array(getlocal("thread.error.cannot_view"));
|
||||||
start_html_output();
|
$chat_style->render('error');
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,8 +112,7 @@ if (!$thread) {
|
|||||||
|
|
||||||
if ($thread->agentId != $operator['operatorid'] && !is_capable(CAN_VIEWTHREADS, $operator)) {
|
if ($thread->agentId != $operator['operatorid'] && !is_capable(CAN_VIEWTHREADS, $operator)) {
|
||||||
$errors = array("Cannot view threads");
|
$errors = array("Cannot view threads");
|
||||||
start_html_output();
|
$chat_style->render('error');
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,12 +126,12 @@ start_html_output();
|
|||||||
$pparam = verifyparam("act", "/^(redirect)$/", "default");
|
$pparam = verifyparam("act", "/^(redirect)$/", "default");
|
||||||
if ($pparam == "redirect") {
|
if ($pparam == "redirect") {
|
||||||
setup_redirect_links($threadid, $operator, $token);
|
setup_redirect_links($threadid, $operator, $token);
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "redirect.tpl");
|
$chat_style->render('redirect');
|
||||||
} else {
|
} else {
|
||||||
// Build js application options
|
// Build js application options
|
||||||
$page['chatOptions'] = json_encode($page['chat']);
|
$page['chatOptions'] = json_encode($page['chat']);
|
||||||
// Expand page
|
// Expand page
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "chat.tpl");
|
$chat_style->render('chat');
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -21,6 +21,9 @@ require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
|||||||
require_once(dirname(dirname(__FILE__)).'/libs/getcode.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/getcode.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/styles.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/styles.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
force_password($operator);
|
force_password($operator);
|
||||||
@ -34,7 +37,7 @@ if (!isset($imageLocales[$image])) {
|
|||||||
}
|
}
|
||||||
$image_locales = $imageLocales[$image];
|
$image_locales = $imageLocales[$image];
|
||||||
|
|
||||||
$stylelist = get_style_list(dirname(dirname(__FILE__)).'/styles/dialogs');
|
$stylelist = ChatStyle::availableStyles();
|
||||||
$stylelist[""] = getlocal("page.preview.style_default");
|
$stylelist[""] = getlocal("page.preview.style_default");
|
||||||
$style = verifyparam("style", "/^\w*$/", "");
|
$style = verifyparam("style", "/^\w*$/", "");
|
||||||
if ($style && !in_array($style, $stylelist)) {
|
if ($style && !in_array($style, $stylelist)) {
|
||||||
|
@ -21,6 +21,9 @@ require_once(dirname(dirname(__FILE__)).'/libs/chat.php');
|
|||||||
require_once(dirname(dirname(__FILE__)).'/libs/expand.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/expand.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/classes/thread.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/thread.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
|
|
||||||
@ -35,6 +38,9 @@ if (! $thread) {
|
|||||||
$page = array();
|
$page = array();
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
|
// Initialize chat style which is currently used in system
|
||||||
|
$chat_style = new ChatStyle(ChatStyle::currentStyle());
|
||||||
|
|
||||||
if (isset($_GET['nextGroup'])) {
|
if (isset($_GET['nextGroup'])) {
|
||||||
$nextid = verifyparam("nextGroup", "/^\d{1,8}$/");
|
$nextid = verifyparam("nextGroup", "/^\d{1,8}$/");
|
||||||
$nextGroup = group_by_id($nextid);
|
$nextGroup = group_by_id($nextid);
|
||||||
@ -110,10 +116,11 @@ $page = array_merge_recursive(
|
|||||||
$page,
|
$page,
|
||||||
setup_logo()
|
setup_logo()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($errors) > 0) {
|
if (count($errors) > 0) {
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "error.tpl");
|
$chat_style->render('error');
|
||||||
} else {
|
} else {
|
||||||
expand(dirname(dirname(__FILE__)).'/styles/dialogs', getchatstyle(), "redirected.tpl");
|
$chat_style->render('redirected');
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
@ -21,6 +21,9 @@ require_once(dirname(dirname(__FILE__)).'/libs/settings.php');
|
|||||||
require_once(dirname(dirname(__FILE__)).'/libs/styles.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/styles.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/cron.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/cron.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
force_password($operator);
|
force_password($operator);
|
||||||
@ -29,7 +32,7 @@ csrfchecktoken();
|
|||||||
$page = array('agentId' => '');
|
$page = array('agentId' => '');
|
||||||
$errors = array();
|
$errors = array();
|
||||||
|
|
||||||
$stylelist = get_style_list(dirname(dirname(__FILE__)).'/styles/dialogs');
|
$stylelist = ChatStyle::availableStyles();
|
||||||
$operator_pages_style_list = get_style_list(dirname(dirname(__FILE__)).'/styles/operator_pages');
|
$operator_pages_style_list = get_style_list(dirname(dirname(__FILE__)).'/styles/operator_pages');
|
||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
@ -39,7 +42,7 @@ $options = array(
|
|||||||
'hosturl',
|
'hosturl',
|
||||||
'usernamepattern',
|
'usernamepattern',
|
||||||
'operator_pages_style',
|
'operator_pages_style',
|
||||||
'chatstyle',
|
'chat_style',
|
||||||
'chattitle',
|
'chattitle',
|
||||||
'geolink',
|
'geolink',
|
||||||
'geolinkparams',
|
'geolinkparams',
|
||||||
@ -69,9 +72,9 @@ if (isset($_POST['email']) && isset($_POST['title']) && isset($_POST['logo'])) {
|
|||||||
$params['sendmessagekey'] = verifyparam('sendmessagekey', "/^c?enter$/");
|
$params['sendmessagekey'] = verifyparam('sendmessagekey', "/^c?enter$/");
|
||||||
$params['cron_key'] = getparam('cronkey');
|
$params['cron_key'] = getparam('cronkey');
|
||||||
|
|
||||||
$params['chatstyle'] = verifyparam("chatstyle", "/^\w+$/", $params['chatstyle']);
|
$params['chat_style'] = verifyparam("chat_style", "/^\w+$/", $params['chat_style']);
|
||||||
if (!in_array($params['chatstyle'], $stylelist)) {
|
if (!in_array($params['chat_style'], $stylelist)) {
|
||||||
$params['chatstyle'] = $stylelist[0];
|
$params['chat_style'] = $stylelist[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$params['operator_pages_style'] = verifyparam("operator_pages_style", "/^\w+$/", $params['operator_pages_style']);
|
$params['operator_pages_style'] = verifyparam("operator_pages_style", "/^\w+$/", $params['operator_pages_style']);
|
||||||
@ -121,7 +124,7 @@ $page['formgeolinkparams'] = topage($params['geolinkparams']);
|
|||||||
$page['formusernamepattern'] = topage($params['usernamepattern']);
|
$page['formusernamepattern'] = topage($params['usernamepattern']);
|
||||||
$page['formoperatorpagesstyle'] = $params['operator_pages_style'];
|
$page['formoperatorpagesstyle'] = $params['operator_pages_style'];
|
||||||
$page['availableOperatorPagesStyles'] = $operator_pages_style_list;
|
$page['availableOperatorPagesStyles'] = $operator_pages_style_list;
|
||||||
$page['formchatstyle'] = $params['chatstyle'];
|
$page['formchatstyle'] = $params['chat_style'];
|
||||||
$page['formchattitle'] = topage($params['chattitle']);
|
$page['formchattitle'] = topage($params['chattitle']);
|
||||||
$page['formsendmessagekey'] = $params['sendmessagekey'];
|
$page['formsendmessagekey'] = $params['sendmessagekey'];
|
||||||
$page['availableChatStyles'] = $stylelist;
|
$page['availableChatStyles'] = $stylelist;
|
||||||
|
@ -22,12 +22,14 @@ require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
|
|||||||
require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/expand.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/expand.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/settings.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/settings.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/styles.php');
|
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
|
|
||||||
$stylelist = get_style_list(dirname(dirname(__FILE__)).'/styles/dialogs');
|
$stylelist = ChatStyle::availableStyles();
|
||||||
|
|
||||||
$preview = verifyparam("preview", "/^\w+$/", "default");
|
$preview = verifyparam("preview", "/^\w+$/", "default");
|
||||||
if (!in_array($preview, $stylelist)) {
|
if (!in_array($preview, $stylelist)) {
|
||||||
@ -35,13 +37,15 @@ if (!in_array($preview, $stylelist)) {
|
|||||||
$preview = $stylelist[$style_names[0]];
|
$preview = $stylelist[$style_names[0]];
|
||||||
}
|
}
|
||||||
|
|
||||||
$style_config = get_dialogs_style_config($preview);
|
$chat_style = new ChatStyle($preview);
|
||||||
|
|
||||||
|
$style_config = $chat_style->configurations();
|
||||||
|
|
||||||
$screenshots = array();
|
$screenshots = array();
|
||||||
foreach($style_config['screenshots'] as $name => $desc) {
|
foreach($style_config['screenshots'] as $name => $desc) {
|
||||||
$screenshots[] = array(
|
$screenshots[] = array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'file' => $mibewroot . '/styles/dialogs/' . $preview
|
'file' => $mibewroot . '/' . $chat_style->filesPath()
|
||||||
. '/screenshots/' . $name . '.png',
|
. '/screenshots/' . $name . '.png',
|
||||||
'description' => $desc
|
'description' => $desc
|
||||||
);
|
);
|
||||||
|
@ -19,6 +19,9 @@ require_once(dirname(dirname(__FILE__)).'/libs/init.php');
|
|||||||
require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/operator.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/groups.php');
|
||||||
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
require_once(dirname(dirname(__FILE__)).'/libs/view.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/interfaces/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/style.php');
|
||||||
|
require_once(dirname(dirname(__FILE__)).'/libs/classes/chat_style.php');
|
||||||
|
|
||||||
$operator = check_login();
|
$operator = check_login();
|
||||||
force_password($operator);
|
force_password($operator);
|
||||||
@ -41,7 +44,8 @@ $page['geoLink'] = Settings::get('geolink');
|
|||||||
$page['geoWindowParams'] = Settings::get('geolinkparams');
|
$page['geoWindowParams'] = Settings::get('geolinkparams');
|
||||||
|
|
||||||
// Load dialogs style options
|
// Load dialogs style options
|
||||||
$style_config = get_dialogs_style_config(getchatstyle());
|
$chat_style = new ChatStyle(ChatStyle::currentStyle());
|
||||||
|
$style_config = $chat_style->configurations();
|
||||||
$page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params'];
|
$page['chatStyles.chatWindowParams'] = $style_config['chat']['window_params'];
|
||||||
|
|
||||||
// Load core style options
|
// Load core style options
|
||||||
|
@ -125,18 +125,18 @@ require_once(dirname(__FILE__).'/inc_errors.php');
|
|||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="operator_pages_style" class="flabel"><?php echo getlocal('settings.operator_pages_style') ?></label>
|
<label for="operator_pages_style" class="flabel"><?php echo getlocal('settings.operator_pages_style') ?></label>
|
||||||
<div class="fvalue">
|
<div class="fvalue">
|
||||||
<select id="chatstyle" name="operator_pages_style" ><?php foreach($page['availableOperatorPagesStyles'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("operatorpagesstyle") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
|
<select id="operator_pages_style" name="operator_pages_style" ><?php foreach($page['availableOperatorPagesStyles'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("operatorpagesstyle") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
|
||||||
</div>
|
</div>
|
||||||
<label for="operator_pages_style" class="fdescr"> — <?php echo getlocal('settings.operator_pages_style.description') ?></label>
|
<label for="operator_pages_style" class="fdescr"> — <?php echo getlocal('settings.operator_pages_style.description') ?></label>
|
||||||
<br clear="all"/>
|
<br clear="all"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<label for="chatstyle" class="flabel"><?php echo getlocal('settings.chatstyle') ?></label>
|
<label for="chat_style" class="flabel"><?php echo getlocal('settings.chatstyle') ?></label>
|
||||||
<div class="fvalue">
|
<div class="fvalue">
|
||||||
<select id="chatstyle" name="chatstyle" ><?php foreach($page['availableChatStyles'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("chatstyle") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
|
<select id="chat_style" name="chat_style" ><?php foreach($page['availableChatStyles'] as $k) { echo "<option value=\"".$k."\"".($k == form_value("chatstyle") ? " selected=\"selected\"" : "").">".$k."</option>"; } ?></select>
|
||||||
</div>
|
</div>
|
||||||
<label for="chatstyle" class="fdescr"> — <?php echo getlocal('settings.chatstyle.description') ?></label>
|
<label for="chat_style" class="fdescr"> — <?php echo getlocal('settings.chatstyle.description') ?></label>
|
||||||
<br clear="all"/>
|
<br clear="all"/>
|
||||||
</div>
|
</div>
|
||||||
<?php if ($page['enabletracking']) { ?>
|
<?php if ($page['enabletracking']) { ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user