function regHTML($website, $type, $task)
    {
        global $mosConfig_lang, $mainframe;
        $bc_version = bc_getVersion();
        if (!$type) {
            //registration
            $bcItemid = JRequest::getInt('Itemid');
            if (!$website->url) {
                echo "Error 0021 : " . _BC_CONTACTWEBMASTER . "\n";
                return;
            }
            $request = "https://www.blastchat.com/index2.php" . "?option=com_bcaccount" . "&cbctask=register" . "&url=" . $website->url . "&intraid=" . $website->intra_id . "&lang=" . $mosConfig_lang . "&bcItemid=" . $bcItemid . "&bc_ver=3.0" . "&prod=" . $bc_version->PRODUCT . "&rel=" . $bc_version->RELEASE . "&dev=" . $bc_version->DEV_LEVEL;
        } else {
            //configuration
            $request = "https://www.blastchat.com/index2.php?option=com_bcaccount&cbctask=bcaccount";
        }
        $goingtodetach = JRequest::getInt('d', 2);
        $detached = $mainframe->getUserStateFromRequest("detached", 'd', 0);
        $expanded = $mainframe->getUserStateFromRequest("expanded", 'e', $website->adm_expand);
        $website->adm_expand = $expanded;
        $website->store();
        ?>
<script language="JavaScript" type="text/javascript">
<!--
function expand() {
	this.location.href="index2.php?option=com_blastchatc&task=<?php 
        echo $task;
        ?>
&e=1";
}

function collapse() {
	this.location.href="index2.php?option=com_blastchatc&task=<?php 
        echo $task;
        ?>
&e=0";
}

function detach() {
	this.location.href="index2.php?option=com_blastchatc&task=<?php 
        echo $task;
        ?>
&d=1";
}

function undetach() {
	this.location.href="index2.php?option=com_blastchatc&task=<?php 
        echo $task;
        ?>
&d=0";
}
//-->
</script>
<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform"">
	<tr>
			<?php 
        if (!$type) {
            ?>
				<th nowrap width="100%"><span class="sectionname">&nbsp;BlastChat - <?php 
            echo _BC_MENU_REG;
            ?>
</span></th>
				<th><img height="20px" src="../../components/com_blastchatc/images/gplv3-88x31.png"></img></th>
			<?php 
        } else {
            ?>
				<th nowrap width="100%"><span class="sectionname">&nbsp;BlastChat - <?php 
            echo _BC_MENU_CONFIG_S;
            ?>
</span></th>
			<?php 
        }
        ?>
	</tr>
</table>

	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminform"">
		<tr>
			<td>
<?php 
        if ($goingtodetach == 1) {
            ?>
<div id="errmsg"></div>
<script language="javascript" type="text/javascript">
<!--
var mine = window.open("<?php 
            echo $request;
            ?>
","BlastChat","WIDTH=<?php 
            echo $website->d_width;
            ?>
, HEIGHT=<?php 
            echo $website->d_height;
            ?>
, location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=yes");
if (!mine) {
	var objId = 'errmsg';
	var text = "<?php 
            echo _BC_ERROR_NOPOPUP;
            ?>
";
	text = text + "<br>" + '<?php 
            echo sprintf(_BC_OPENUNDETACHED, "<a href=\"" . bc_getLiveSite() . "/index.php?option=com_blastchatc&d=0\">" . _BC_OPENUNDETACHED_HERE . "</a>");
            ?>
';
	if (document.layers) { //Netscape 4
		myObj = eval('document.' + objId);
		myObj.document.open();
		myObj.document.write(text);
		myObj.document.close();
	} else 	if ((document.all && !document.getElementById) || navigator.userAgent.indexOf("Opera") != -1) { //IE 4 & Opera
		myObj = eval('document.all.' + objId);
		myObj.innerHTML = text;
	} else if (document.getElementById) { //Netscape 6 & IE 5
		myObj = document.getElementById(objId);
		myObj.innerHTML = '';
		myObj.innerHTML = text;
	} else {
		alert('<?php 
            echo _BC_OLDBROWSER;
            ?>
');
	}
}
//-->
</script>
<?php 
        } elseif ($goingtodetach == 0 || $detached == 0 || !$type) {
            if ($expanded || !$type) {
                ?>
<iframe NAME="blastchatc" ID="blastchatc" SRC="<?php 
                echo $request;
                ?>
" HEIGHT="480" WIDTH="100%" FRAMEBORDER="0" marginwidth="0" marginheight="0" SCROLLING="AUTO">
</iframe>
<?php 
            }
        }
        ?>
<!-- !!! Do not remove, tamper with, obstruct visibility or obstruct readability of following code unless you have received written permission to do so by owner of BlastChat !!! -->
<div align="center" style="width:100%; font-size: 10px; text-align:center; margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px;">Powered by <a href="http://www.blastchat.com" target="_blank" title="BlastChat - free chat for your website">BlastChat</a></div>
			</td>
		</tr>
	</table>
<?php 
    }
Ejemplo n.º 2
0
}
require_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'api.blastchatc.php';
$mosConfig_live_site = bc_getLiveSite();
//strip http or https from this website URL
//if you need this to be something else, adjust bc_getLiveSite function in api.blastchatc.php file
$bc_site = $mosConfig_live_site;
$bc_site = strtolower($bc_site);
$bc_site = str_replace("http://", "", $bc_site);
$bc_site = str_replace("https://", "", $bc_site);
$bc_site_other = "";
if (strpos($bc_site, "www.") === false) {
    $bc_site_other = "www." . $bc_site;
} else {
    $bc_site_other = str_replace("www.", "", $bc_site);
}
$bc_version = bc_getVersion();
$myss = bc_getSessionData();
$detached = JRequest::getInt('d', 2);
//overwrite admin backend configuration to open chat as detached or undetached
$bc_task = JRequest::getString('bc_task', null);
$rid = JRequest::getInt('rid', 0);
$rsid = JRequest::getInt('rsid', 0);
$bc_Itemid = JRequest::getString('Itemid', null);
$db =& JFactory::getDBO();
//getBlastChat data of your website from blastchatc table
$website = null;
$website = new josBC_website($db);
$website->loadByURL($bc_site);
if (!$website->url) {
    $website->loadByURL($bc_site_other);
    if ($website->url) {