示例#1
0
	function getBadge($params, &$popup_div, $isIE7){
		if($params != null){
			$s = $params->get('sl_badge_series');
			$t = $params->get('sl_badge_type');
			$c = $params->get('sl_badge_color');
			$sl_position = $params->get('sl_position');
			$sl_pad_top = $params->get('custom_pad_top');
			$sl_pad_right = $params->get('custom_pad_right');
			$sl_pad_left = $params->get('custom_pad_left');
			$sl_pad_bottom = $params->get('custom_pad_bottom');
			$sl_margin_top = $params->get('custom_margin_top');
			$sl_margin_right = $params->get('custom_margin_right');
			$sl_margin_left = $params->get('custom_margin_left');
			$sl_margin_bottom = $params->get('custom_margin_bottom');
			$custom_position = $params->get('custom_position');
			$custom_zindex = $params->get('custom_zindex');
			$sl_popup = $params->get('sl_popup');
			$mod_suffix = $params->get('moduleclass_sfx');
		}
		else {
			$s = 0;
			$t = 0;
			$c =0;
			$sl_position = 0;
			$sl_pad_top = 0;
			$sl_pad_right =0;
			$sl_pad_left = 0;
			$sl_pad_bottom = 0;
			$sl_margin_top = 0;
			$sl_margin_right = 0;
			$sl_margin_left = 0;
			$sl_margin_bottom = 0;
			$custom_position = 0;
			$custom_zindex = 0;
			$sl_popup = 1;
			$mod_suffix = 0;
		}
	        
			$output = '';
	        
	        //Setup Containing Div for badge
	        $textAlign = "";
	        switch($sl_position)
	        {
	            default:
	            case "01"://left
	            case "04"://custom
	                $textAlign = 'left';
	                break;
	                
	            case "02"://center
	                $textAlign = 'center';
	                break;
	                
	            case "03"://right
	                $textAlign = 'right';
	                break;
	        }
	        $output.='<div name="sl_floatingModDiv_Container" style="background: transparent !important; text-align: '.$textAlign.'" style="width: 100%">';
	        
	        //use standard style or custom style for inner div?
	        if($sl_position == 4){
	            $output .= '<div name="sl_floatingModDiv" '
	            .(isset($mod_suffix)?('id="'.$mod_suffix.'" '):'')
	            .'style="'
	            .(isset($sl_margin_left)?('margin-left: '.$sl_margin_left.'px; '): '')
	            .(isset($sl_margin_right)?('margin-right: '.$sl_margin_right.'px; '): '')
	            .(isset($sl_margin_top)?('margin-top: '.$sl_margin_top.'px; '): '')
	            .(isset($sl_margin_bottom)?('margin-bottom: '.$sl_margin_bottom.'px; '): '')
	            .(isset($sl_pad_left)?('padding-left: '.$sl_pad_left.'px; '): '')
	            .(isset($sl_pad_right)?('padding-right: '.$sl_pad_right.'px; '): '')
	            .(isset($sl_pad_top)?('padding-top: '.$sl_pad_top.'px; '): '')
	            .(isset($sl_pad_bottom)?('padding-bottom: '.$sl_pad_bottom.'px; '): '')
	            .'display: inline; height: 50px; width: 105px; text-align: inherit ! important; background: transparent !important;'
	            .(isset($custom_position)?('position: '.$custom_position.'; '): '')
	            .(isset($custom_zindex)?('z-index: '.$custom_zindex .'; '): '')
	            .'">';
	        } else {
	            $output .= '<div name="sl_floatingModDiv" style="text-align: inherit ! important; background: transparent !important;" '.(isset($mod_suffix)?'id="'.$mod_suffix.'" ':'').'>';
	        }
	        
			//Include popup optioni?
			if ($sl_popup == "1"){
		 		$output .= '<a href="javascript:void(0)" onclick="return Badge_OnClick();">   
	                        <img src="https://www.securelive.net/badges/image_create.php?s='.$s.'&amp;t='.$t.'&amp;c='.$c.'" style="border: none;" alt="SecureLive Badge" title="SecureLive Badge" /> </a>';
				$popup_div = getPopupDiv($isIE7);
			} else {
				$output .= '<img src="https://www.securelive.net/badges/image_create.php?s='.$s.'&amp;t='.$t.'&amp;c='.$c.'" style="border: none;" alt="SecureLive Badge" title="SecureLive Badge" />';
	        	$popup_div = false;
	        }
	        
	        //close started tags
			$output .= '</div></div>';
			return $output;
		}	
				$senderName = $sender->name;
			$msg['content'] = str_replace(array('"', "\n"), array('\\"', '\\n'), str_replace("\r\n", "\n", preg_replace('~([^>="\']|^)(http://[0-9a-zA-Z/&#?%=,_\-\.]+)~', '\1<a href="\2" target="_blank">\2</a>', $msg['content'])));
			$msg['title']   = str_replace(array('"', "\n"), array('\\"', '\\n'), str_replace("\r\n", "\n", $msg['title']));
			$msg['sender']  = str_replace(array('"', "\n"), array('\\"', '\\n'), str_replace("\r\n", "\n", $senderName));
			
			if ($msgCount > 1) $msgNext = 1;
		} else {
			//avoid unexpected error
			$msgNext = 0;
		}
	}
    forceLogout($username, $time);
    $popupDoctorAppDiv = $popupSendUrlDiv = '""';
    if (false == $user->isNull() && canPopupDoctorAppDiv($user)) 
    {
        $popupDoctorAppDiv = getPopupDiv($user);
    }
    if (false == $user->isNull() && canSendDoctorAppDiv($user)) 
    {
        $popupSendUrlDiv = getPopupSendUrlDiv();
    }
    $result = '{"verion":"'.$code_version.'","msg_count":'.(int)$msgCount.',"user_name":"'.$username.'","msg_id":"'.$msg['id'].'","msg_senderid":"'.$msg['senderId'].'","msg_sender":"'.$msg['sender'].'","msg_title":"'.$msg['title'].'","msg_content":"'.$msg['content'].'","msg_next":"'.$msgNext.'","popup_div":'.$popupDoctorAppDiv.',"popup_sendurl_div":'.$popupSendUrlDiv.'}';

} else {
    $result = '{}';
}

$tmpRequest = new Request();
$callback = $tmpRequest->callback;
if ($callback) {
	$result = $callback.'('.$result.');';