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
    include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $lang->getTag() . '.php';
}
if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $backward_lang . '.php')) {
    include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $backward_lang . '.php';
}
if ($backward_lang != 'english' && file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . 'english.php')) {
    include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . 'english.php';
}
if (!file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'api.blastchatc.php')) {
    echo "Missing file \"api.blastchatc.php\"";
    return;
}
require_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'api.blastchatc.php';
require_once 'admin.blastchatc.html.php';
require_once 'class.blastchatc.php';
$mosConfig_live_site = bc_getLiveSite();
//strip http or https from this website URL, global variable
//if you need this to be something else,assign another value to $mosConfig_live_site (do same for admin.blastchac.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);
}
$detached = JRequest::getInt('d', 2);
//overwrite admin backend configuration to open chat as detached or undetached
$task = JRequest::getString('task', null);
Ejemplo n.º 3
0
function com_install()
{
    JHTML::_('behavior.mootools');
    JHTMLBehavior::tooltip();
    $lang =& JFactory::getLanguage();
    $backward_lang = $lang->getBackwardLang();
    $db =& JFactory::getDBO();
    // Get the languages file if it exists
    if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $lang->getTag() . '.php')) {
        include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $lang->getTag() . '.php';
    }
    if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $backward_lang . '.php')) {
        include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . $backward_lang . '.php';
    }
    if (file_exists(JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . 'english.php')) {
        include_once JPATH_ROOT . DS . 'components' . DS . 'com_blastchatc' . DS . 'languages' . DS . 'english.php';
    }
    @ini_set("max_execution_time", "60");
    $db->setQuery("CREATE TABLE IF NOT EXISTS `#__blastchatc` (\r\n\t\t`id` int(11) NOT NULL auto_increment,\r\n\t\t`url` varchar(100) default NULL,\r\n\t\t`intra_id` varchar(100) default NULL,\r\n\t\t`priv_key` varchar(100) default NULL,\r\n\t\t`detached` binary(1) NOT NULL default 0,\r\n\t\t`adm_expand` binary(1) NOT NULL default 1,\r\n\t\t`width` varchar(6) NOT NULL default '100%',\r\n\t\t`height` varchar(6) NOT NULL default '480',\r\n\t\t`d_width` varchar(6) NOT NULL default '640',\r\n\t\t`d_height` varchar(6) NOT NULL default '480',\r\n\t\t`frame_border` binary(1) NOT NULL default 0,\r\n\t\t`m_width` varchar(6) NOT NULL default '0',\r\n\t\t`m_height` varchar(6) NOT NULL default '0',\r\n\t\tPRIMARY KEY ( `id` ),\r\n\t\tUNIQUE KEY (`url`)\r\n\t\t);\r\n\t\t");
    if (!$db->query()) {
        $result = "Error 0013 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true);
        return $result;
    }
    $query = "SHOW COLUMNS FROM #__blastchatc_users ";
    $db->setQuery($query);
    $cols = false;
    $cols = $db->loadRowList();
    if ($cols[0][0] == "userid") {
        $query = "DROP TABLE IF EXISTS `#__blastchatc_users`";
        $db->setQuery($query);
        $db->query();
    }
    $db->setQuery("CREATE TABLE IF NOT EXISTS `#__blastchatc_users` (\r\n\t\t`bc_userid` int(11) default 0,\r\n\t\t`bc_lastEntry` datetime NOT NULL default '0000-00-00 00:00:00',\r\n\t\t`bc_idle` varchar(5) default NULL,\r\n\t\t`bc_rid` INT(11) NOT NULL default 0,\r\n\t\t`bc_rsid` INT(11) NOT NULL default 0,\r\n\t\t`bc_rname` VARCHAR(100) default NULL,\r\n\t\tPRIMARY KEY (`bc_userid`)\r\n\t\t);\r\n\t\t");
    if (!$db->query()) {
        $result = "Error 0014 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true);
        return $result;
    }
    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, global variable
    //if you need this to be something else,assign another value to $mosConfig_live_site (do same for admin.blastchac.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);
    }
    require_once JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_blastchatc' . DS . 'class.blastchatc.php';
    $website = null;
    $website = new josBC_website($db);
    $website->loadByURL($bc_site);
    if (!$website->url) {
        $website->loadByURL($bc_site_other);
        if (!$website->url) {
            $website->intra_id = md5($bc_site . uniqid(microtime(), 1));
            $website->url = $bc_site;
            $website->store();
        }
    }
    //Set up icons for admin area
    $result = null;
    $menu_config = _BC_MENU_CONFIG;
    $menu_config_alt = _BC_BLASTCHAT . " - " . _BC_MENU_CONFIG;
    $menu_reg = _BC_MENU_REG;
    $menu_reg_alt = _BC_BLASTCHAT . " - " . _BC_MENU_REG;
    $menu_credits = _BC_MENU_CREDITS;
    $menu_credits_alt = _BC_BLASTCHAT . " - " . _BC_MENU_CREDITS;
    //$db->setQuery("UPDATE #__components SET admin_menu_img='../components/com_blastchatc/images/config.png', name='$menu_config', admin_menu_alt='$menu_config_alt' WHERE admin_menu_link='option=com_blastchatc&task=config'");
    $db->setQuery("UPDATE #__components SET name='{$menu_config}', admin_menu_alt='{$menu_config_alt}' WHERE admin_menu_link='option=com_blastchatc&task=config'");
    if (!$db->query()) {
        $result = "Error 0010 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true);
    } else {
        //$db->setQuery("UPDATE #__components SET admin_menu_img='../components/com_blastchatc/images/credits.png', name='$menu_reg', admin_menu_alt='$menu_reg_alt' WHERE admin_menu_link='option=com_blastchatc&task=register'");
        $db->setQuery("UPDATE #__components SET name='{$menu_reg}', admin_menu_alt='{$menu_reg_alt}' WHERE admin_menu_link='option=com_blastchatc&task=register'");
        if (!$db->query()) {
            $result = "Error 0011 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true);
        } else {
            //$db->setQuery("UPDATE #__components SET admin_menu_img='../components/com_blastchatc/images/credits.png', name='$menu_credits', admin_menu_alt='$menu_credits_alt' WHERE admin_menu_link='option=com_blastchatc&task=credits'");
            $db->setQuery("UPDATE #__components SET name='{$menu_credits}', admin_menu_alt='{$menu_credits_alt}' WHERE admin_menu_link='option=com_blastchatc&task=credits'");
            if (!$db->query()) {
                $result = "Error 0012 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true);
            } else {
                //needed for module support, field marks which user is inside chat
                $db->setQuery("ALTER TABLE `#__session` , ADD `bc_lastUpdate` VARCHAR( 14 ) NULL ");
                if (!$db->query()) {
                    $result = "Error 0015 : " . _BC_CONTACTWEBMASTER . "\n<br><br>" . $db->stderr(true);
                } else {
                    ?>
	[&nbsp;<a href="index2.php?option=com_blastchatc&task=register" style="font-size: 12px; font-weight: bold"><?php 
                    echo _BC_REGNOW;
                    ?>
&nbsp;...</a>&nbsp;]
	<br />
<div class="footer" align="center">
	<table border="0" width="99%">
	<tbody>
	<tr>
	<td align="center">
	<div align="center"><a href="http://www.blastchat.com" target="_blank">BlastChat Client 3.0</a>, GNU/GPL License</div>
	<div class="smallgrey" align="center">Copyright (C) 2004-2009 <a href="http://www.blastchat.com" target="_blank">BlastChat</a>. All rights reserved.</div>
	</td>
	</tr>
	</tbody>
	</table>
</div>
<?php 
                }
            }
        }
    }
    return $result;
}