mirror of
https://github.com/Mibew/java.git
synced 2025-01-22 17:40:35 +03:00
update to use styles folder
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@184 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
c51bcad83b
commit
3e4e6802fe
@ -26,7 +26,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) {
|
||||
|
||||
if( !$thread ) {
|
||||
if(!has_online_operators()) {
|
||||
expand("design/default/leavemessage.tpl");
|
||||
expand("styles", getchatstyle(), "leavemessage.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -66,13 +66,13 @@ setup_chatview_for_user($thread, $level);
|
||||
|
||||
$pparam = verifyparam( "act", "/^(mailthread)$/", "default");
|
||||
if( $pparam == "mailthread" ) {
|
||||
expand("design/default/mail.tpl");
|
||||
expand("styles", getchatstyle(), "mail.tpl");
|
||||
} else if( $level == "ajaxed" ) {
|
||||
expand("design/default/chat.tpl");
|
||||
expand("styles", getchatstyle(), "chat.tpl");
|
||||
} else if( $level == "simple" ) {
|
||||
expand("design/default/chatsimple.tpl");
|
||||
expand("styles", getchatstyle(), "chatsimple.tpl");
|
||||
} else if( $level == "old" ) {
|
||||
expand("design/default/nochat.tpl");
|
||||
expand("styles", getchatstyle(), "nochat.tpl");
|
||||
}
|
||||
|
||||
?>
|
@ -39,7 +39,7 @@ if( count($errors) > 0 ) {
|
||||
$page['formname'] = topage($visitor_name);
|
||||
$page['formemail'] = $email;
|
||||
$page['formmessage'] = topage($message);
|
||||
expand("design/default/leavemessage.tpl");
|
||||
expand("styles", getchatstyle(), "leavemessage.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -53,5 +53,5 @@ if($inbox_mail) {
|
||||
webim_mail($inbox_mail, $email, $subject, $body);
|
||||
}
|
||||
|
||||
expand("design/default/leavemessagesent.tpl");
|
||||
expand("styles", getchatstyle(), "leavemessagesent.tpl");
|
||||
?>
|
@ -433,7 +433,8 @@ $settings = array(
|
||||
'logo' => '',
|
||||
'enableban' => '0',
|
||||
'usernamepattern' => '{name}',
|
||||
'usercanchangename' => '1'
|
||||
'usercanchangename' => '1',
|
||||
'chatstyle' => 'default'
|
||||
);
|
||||
$settingsloaded = false;
|
||||
$settings_in_db = array();
|
||||
@ -457,4 +458,10 @@ function loadsettings() {
|
||||
mysql_close($link);
|
||||
}
|
||||
|
||||
function getchatstyle() {
|
||||
global $settings;
|
||||
loadsettings();
|
||||
return $settings['chatstyle'];
|
||||
}
|
||||
|
||||
?>
|
@ -80,9 +80,15 @@ function expandtext($text) {
|
||||
return preg_replace_callback("/\\\${(\w+:)?([\w\.,]+)}/", "expand_var", $text);
|
||||
}
|
||||
|
||||
function expand($filename) {
|
||||
function expand($basedir,$style,$filename) {
|
||||
start_html_output();
|
||||
$contents = @file_get_contents($filename) or die("illegal template");
|
||||
if(!is_dir("$basedir/$style")) {
|
||||
$style = "default";
|
||||
}
|
||||
$contents = @file_get_contents("$basedir/$style/$filename");
|
||||
if($contents === false) {
|
||||
$contents = @file_get_contents("$basedir/default/$filename") or die("cannot load template");
|
||||
}
|
||||
echo expandtext($contents);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ if( count($errors) > 0 ) {
|
||||
$page['ct.chatThreadId'] = $thread['threadid'];
|
||||
$page['ct.token'] = $thread['ltoken'];
|
||||
$page['level'] = "";
|
||||
expand("design/default/mail.tpl");
|
||||
expand("styles", getchatstyle(), "mail.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -57,5 +57,5 @@ $body = getstring2("mail.user.history.body", array($thread['userName'],$history)
|
||||
|
||||
webim_mail($email, $webim_from_email, $subject, $body);
|
||||
|
||||
expand("design/default/mailsent.tpl");
|
||||
expand("styles", getchatstyle(), "mailsent.tpl");
|
||||
?>
|
@ -79,9 +79,9 @@ if( $pparam == "redirect" ) {
|
||||
}
|
||||
$page['pagination_list'] = $agent_list;
|
||||
|
||||
expand("../design/default/redirect.tpl");
|
||||
expand("../styles", getchatstyle(), "redirect.tpl");
|
||||
} else {
|
||||
expand("../design/default/chat.tpl");
|
||||
expand("../styles", getchatstyle(), "chat.tpl");
|
||||
}
|
||||
|
||||
?>
|
@ -19,20 +19,20 @@ require_once('../libs/expand.php');
|
||||
|
||||
$operator = check_login();
|
||||
|
||||
$designlist = array();
|
||||
$designfolder = "../design";
|
||||
if($handle = opendir($designfolder)) {
|
||||
$stylelist = array();
|
||||
$stylesfolder = "../styles";
|
||||
if($handle = opendir($stylesfolder)) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (preg_match("/^\w+$/", $file) && is_dir("$designfolder/$file")) {
|
||||
$designlist[] = $file;
|
||||
if (preg_match("/^\w+$/", $file) && is_dir("$stylesfolder/$file")) {
|
||||
$stylelist[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
$preview = verifyparam("preview","/^\w+$/", "default");
|
||||
if(!in_array($preview, $designlist)) {
|
||||
$preview = $designlist[0];
|
||||
if(!in_array($preview, $stylelist)) {
|
||||
$preview = $stylelist[0];
|
||||
}
|
||||
|
||||
$show = verifyparam("show", "/^(chat|chatsimple|nochat|mail|mailsent|leavemessage|leavemessagesent)$/", "");
|
||||
@ -40,12 +40,12 @@ $show = verifyparam("show", "/^(chat|chatsimple|nochat|mail|mailsent|leavemessag
|
||||
if($show == 'chat' || $show == 'mail' || $show == 'leavemessage' || $show == 'leavemessagesent' || $show == 'chatsimple' || $show == 'nochat') {
|
||||
setup_chatview_for_user(array('threadid' => 0,'userName' => getstring("chat.default.username"), 'ltoken' => 123), "ajaxed");
|
||||
$page['mailLink'] = "$webimroot/operator/preview.php?preview=$preview&show=mail";
|
||||
expand("../design/$preview/$show.tpl");
|
||||
expand("../styles", "$preview", "$show.tpl");
|
||||
exit;
|
||||
}
|
||||
if($show == 'mailsent') {
|
||||
$page['email'] = "admin@yourdomain.com";
|
||||
expand("../design/$preview/$show.tpl");
|
||||
expand("../styles", "$preview", "$show.tpl");
|
||||
exit;
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ $template = verifyparam("template", "/^\w+$/", "chat");
|
||||
|
||||
$page['formpreview'] = $preview;
|
||||
$page['formtemplate'] = $template;
|
||||
$page['availablePreviews'] = $designlist;
|
||||
$page['availablePreviews'] = $stylelist;
|
||||
$page['availableTemplates'] = array("chat", "chatsimple", "nochat", "leavemessage", "leavemessagesent", "mail", "mailsent", "all");
|
||||
$page['operator'] = topage(get_operator_name($operator));
|
||||
$page['showlink'] = "$webimroot/operator/preview.php?preview=$preview&show=";
|
||||
|
@ -51,9 +51,9 @@ if( $nextOperator ) {
|
||||
}
|
||||
|
||||
if( count($errors) > 0 ) {
|
||||
expand("../design/default/error.tpl");
|
||||
expand("../styles", getchatstyle(), "error.tpl");
|
||||
} else {
|
||||
expand("../design/default/redirected.tpl");
|
||||
expand("../styles", getchatstyle(), "redirected.tpl");
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue
Block a user