mirror of
				https://github.com/Mibew/i18n.git
				synced 2025-10-31 17:31:05 +03:00 
			
		
		
		
	expand leavemessage template
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@164 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
		
							parent
							
								
									a017011b5f
								
							
						
					
					
						commit
						29f023ac9a
					
				| @ -15,6 +15,7 @@ | ||||
| require_once('libs/common.php'); | ||||
| require_once('libs/chat.php'); | ||||
| require_once('libs/operator.php'); | ||||
| require_once('libs/expand.php'); | ||||
| 
 | ||||
| if( !isset($_GET['token']) || !isset($_GET['thread']) ) { | ||||
| 
 | ||||
| @ -25,8 +26,7 @@ if( !isset($_GET['token']) || !isset($_GET['thread']) ) { | ||||
| 
 | ||||
| 	if( !$thread ) { | ||||
| 		if(!has_online_operators()) { | ||||
| 			start_html_output(); | ||||
| 			require('view/chat_leavemsg.php'); | ||||
| 			expand("design/default/leavemessage.tpl"); | ||||
| 			exit; | ||||
| 		} | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										1
									
								
								src/messenger/webim/design/default/.htaccess
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/messenger/webim/design/default/.htaccess
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | ||||
| Deny from all | ||||
							
								
								
									
										12
									
								
								src/messenger/webim/design/howto.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/messenger/webim/design/howto.txt
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | ||||
| 
 | ||||
| 	How to create a skin for chat window. | ||||
| 	------------------------------------- | ||||
| 	 | ||||
| 	1. Folder/files structure. | ||||
| 	 | ||||
| 		myskin/ | ||||
| 			chat.tpl | ||||
| 			leavemessage.tpl | ||||
| 			leavemessagesent.tpl | ||||
| 		 | ||||
|   | ||||
| @ -14,6 +14,7 @@ | ||||
| 
 | ||||
| require_once('libs/common.php'); | ||||
| require_once('libs/chat.php'); | ||||
| require_once('libs/expand.php'); | ||||
| 
 | ||||
| $errors = array(); | ||||
| $page = array(); | ||||
| @ -38,8 +39,7 @@ if( count($errors) > 0 ) { | ||||
| 	$page['formname'] = topage($visitor_name); | ||||
| 	$page['formemail'] = $email; | ||||
| 	$page['formmessage'] = topage($message); | ||||
| 	start_html_output(); | ||||
| 	require('view/chat_leavemsg.php'); | ||||
| 	expand("design/default/leavemessage.tpl"); | ||||
| 	exit; | ||||
| } | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										74
									
								
								src/messenger/webim/libs/expand.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										74
									
								
								src/messenger/webim/libs/expand.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,74 @@ | ||||
| <?php | ||||
| /* | ||||
|  * This file is part of Web Instant Messenger project. | ||||
|  * | ||||
|  * Copyright (c) 2005-2008 Web Messenger Community | ||||
|  * All rights reserved. This program and the accompanying materials | ||||
|  * are made available under the terms of the Eclipse Public License v1.0 | ||||
|  * which accompanies this distribution, and is available at | ||||
|  * http://www.eclipse.org/legal/epl-v10.html | ||||
|  * | ||||
|  * Contributors: | ||||
|  *    Evgeny Gryaznov - initial API and implementation | ||||
|  */ | ||||
| 
 | ||||
| function check_condition($condition) { | ||||
| 	global $errors, $page; | ||||
| 	if($condition == 'errors') { | ||||
| 		return isset($errors) && count($errors) > 0; | ||||
| 	} | ||||
| 	return isset($page[$condition]) && $page[$condition]; | ||||
| } | ||||
| 
 | ||||
| function expand_condition($matches) { | ||||
| 	global $page; | ||||
| 	$value = check_condition($matches[2]) ^ ($matches[1] != 'if'); | ||||
| 	if($value) { | ||||
| 		return $matches[3]; | ||||
| 	} else if($matches[4]) { | ||||
| 		return substr($matches[4],strpos($matches[4],"}")+1);  | ||||
| 	} | ||||
| 	return ""; | ||||
| } | ||||
| 
 | ||||
| function expand_var($matches) { | ||||
| 	global $page, $webimroot, $errors; | ||||
| 	$prefix = $matches[1]; | ||||
| 	$var = $matches[2]; | ||||
| 	if(!$prefix) { | ||||
| 		if($var == 'webimroot') { | ||||
| 			return $webimroot; | ||||
| 		} else if($var == 'errors') { | ||||
| 			if( isset($errors) && count($errors) > 0 ) { | ||||
| 				$result = getlocal("errors.header"); | ||||
| 				foreach( $errors as $e ) { | ||||
| 					$result .= getlocal("errors.prefix").$e.getlocal("errors.suffix"); | ||||
| 				} | ||||
| 				$result .= getlocal("errors.footer"); | ||||
| 				return $result; | ||||
| 			}			 | ||||
| 		} | ||||
| 
 | ||||
| 	} else if($prefix == 'msg:') { | ||||
| 		return getlocal($var); | ||||
| 	} else if($prefix == 'form:') { | ||||
| 		return $page["form$var"]; | ||||
| 	} else if($prefix == 'page:') { | ||||
| 		return $page["$var"]; | ||||
| 	} | ||||
| 
 | ||||
| 	return ""; | ||||
| } | ||||
| 
 | ||||
| function expandtext($text) { | ||||
| 	$text = preg_replace_callback("/\\\${(if|ifnot):([\w\.]+)}(.*?)(\\\${else:\\2}.*?)?\\\${endif:\\2}/sm", "expand_condition", $text); | ||||
| 	return preg_replace_callback("/\\\${(\w+:)?([\w\.]+)}/", "expand_var", $text); | ||||
| } | ||||
| 
 | ||||
| function expand($filename) { | ||||
| 	start_html_output(); | ||||
| 	$contents = file_get_contents($filename) or die("illegal template"); | ||||
| 	echo expandtext($contents); | ||||
| } | ||||
| 
 | ||||
| ?>
 | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user