summaryrefslogtreecommitdiffstatshomepage
path: root/data/templates/sscuttlizr/jappix.php
blob: b8f4bad4a68c4b629fe234dfca5426a3a38af79d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
$show = false;

if ( $currentUser->isAdmin() && isset($GLOBALS['jappixEnableForAdmin']) && $GLOBALS['jappixEnableForAdmin'] == true ) {
	$show = true;
} else {
	if ( $userservice->isLoggedOn() && isset($GLOBALS['jappixEnableForLogged']) && $GLOBALS['jappixEnableForLogged'] == true ) {
		$show = true;
	}
}



if ( $show == true ) {
	?>
	<script type="text/javascript">
		
		jQuery.ajaxSetup({cache: true});
		<?php 
		$url = "";
		if ( isset($GLOBALS['jappixUrl']) && $GLOBALS['jappixUrl'] != "" ) {
			$url .= $GLOBALS['jappixUrl'];
		} else {
			$url .= "https://static.jappix.com";
		}
		$url .= '/php/get.php?l=';
		$langs = array('ar', 'bg', 'cs', 'de', 'en', 'eo', 'es', 'et', 'fa', 'fr', 'he', 'hu', 'id', 'it', 'ja', 'la', 'lb', 
										'mn', 'nl', 'oc', 'pl', 'pt-br', 'pt', 'ru', 'sk', 'sv', 'tr', 'uk', 'zh-cn', 'zh-tw');
		if ( isset($GLOBALS['jappixLang']) && in_array($GLOBALS['jappixLang'], $langs) ) {
			$url .= $GLOBALS['jappixLang'];
		} else {
			$url .= 'en';
		}
		$url .= '&t=js&g=mini.xml';

		$autoconnect = ( isset($GLOBALS['jappixAutoConnect']) && $GLOBALS['jappixAutoConnect'] == true ) ? 'true' : 'false';

		$domain = ( isset($GLOBALS['jappixDomain']) && $GLOBALS['jappixDomain'] != "" ) ? $GLOBALS['jappixDomain'] : 'anonymous.jappix.com';

		$paramStr = $autoconnect . ', true, "' . $domain . '"';
		if ( isset($GLOBALS['jappixAuth']) && $GLOBALS['jappixAuth'] == true && isset($GLOBALS['jappixUser']) && isset($GLOBALS['jappixPassword']) ) {
			$paramStr .= ', "' . $GLOBALS['jappixUser'] . '", "' . $GLOBALS['jappixPassword'] . '"';
		}

		$animate = ( isset($GLOBALS['jappixAnimate']) && $GLOBALS['jappixAnimate'] == true ) ? 'MINI_ANIMATE = true;' : 'MINI_ANIMATE = false;';

		$resource = ( isset($GLOBALS['jappixResource']) && $GLOBALS['jappixResource'] != "" ) ? 'MINI_RESOURCE = "' . $GLOBALS['jappixResource'] . '";' : 'SemanticScuttle';

		$nick = ( isset($GLOBALS['jappixNickName']) && $GLOBALS['jappixNickName'] != '' ) ? 'MINI_RANDNICK = true; MINI_NICKNAME = "' . $GLOBALS['jappixNickName'] . '";' : 'MINI_RANDNICK = true;';

		$error = ( isset($GLOBALS['jappixErrorLink']) && $GLOBALS['jappixErrorLink'] != '' ) ? 'MINI_ERROR_LINK = "' . $GLOBALS['jappixErrorLink'] . '";' : 'MINI_ERROR_LINK = https://mini.jappix.com/issues;';

		$disableMobile = ( isset($GLOBALS['jappixDisableMobile']) && $GLOBALS['jappixDisableMobile'] == true ) ? 'MINI_DISABLE_MOBILE = true;' : 'MINI_DISABLE_MOBILE = false;';

		$groupChats = '';
		if ( isset($GLOBALS['jappixGroupChats']) && is_array($GLOBALS['jappixGroupChats']) ) {
			$groupChats .= 'MINI_GROUPCHATS = ["' . implode('", "', $GLOBALS['jappixGroupChats']) . '"];';
		}

		$title = ( isset($GLOBALS['jappixTitle']) && $GLOBALS['jappixTitle'] != "" ) ? 'MINI_TITLE = "' . $GLOBALS['jappixTitle'] . '";' : 'Chat';

		?>
		jQuery.getScript("<?php echo $url; ?>", function() {
			<?php echo $groupChats; ?>
			<?php echo $animate; ?>
			<?php echo $nick ?>
			<?php echo $resource ?>
			<?php echo $error ?>
			<?php echo $title ?>
			<?php echo $disableMobile ?>
			launchMini(<?php echo $paramStr; ?>);
			jQuery('#jappix_mini a.jm_pane').css('height', '25px');
			jQuery('#jappix_mini a.jm_chat-tab, #jappix_mini a.jm_chat-tab.jm_clicked').css('height', '25px');
			jQuery('#jappix_mini div.jm_actions').css('height', '25px');
			jQuery('#jappix_mini div.jm_status_picker a, #jappix_mini div.jm_chan_suggest a').css('height', '20px');
			jQuery('#jappix_mini div.jm_status_picker, #jappix_mini div.jm_chan_suggest').css('top', '24px');
		});
		
	</script>
	<?php
}
?>