/*************************************************************************** * * IMPORTANT: This is a commercial product made by BoonEx Ltd. and cannot be modified for other than personal usage. * This product cannot be redistributed for free or a fee without written permission from BoonEx Ltd. * This notice may not be removed from the source code. * ***************************************************************************/ require_once($sIncPath . "xml.inc.php"); require_once($sIncPath . "constants.inc.php"); require_once($sIncPath . "functions.inc.php"); require_once($sIncPath . "apiFunctions.inc.php"); function rayGetSettingValue($sWidget, $sSettingKey) { return getSettingValue($sWidget, $sSettingKey); } function isBoonexWidgetsRegistered() { global $sGlobalDir; return getSettingValue($sGlobalDir, "registered") == TRUE_VAL; } function setRayBoonexLicense($sLicense) { if(getSettingValue(GLOBAL_MODULE, "license", "main") == $sLicense) return; global $sModulesPath; $rDirHandler = opendir($sModulesPath); while(($sInner = readdir($rDirHandler)) !== false) if(is_dir($sModulesPath . $sInner) && substr($sInner, 0, 1) != '.') { if(isset($aInfo)) unset($aInfo); $sConstantsFile = $sModulesPath . $sInner . "/inc/constants.inc.php"; if(!file_exists($sConstantsFile)) continue; require($sConstantsFile); if(strtolower($aInfo['author']) == 'boonex') setSettingValue($sInner, array("status", "license"), array(WIDGET_STATUS_ENABLED, $sLicense), "main"); } } function getRayIntegrationJS() { global $sHomeUrl; global $sGlobalPath; global $sGlobalUrl; global $sDataPath; $sIntegrationData = $sDataPath . "integration.dat"; $sReturn = ''; return $sReturn; } /** * Checks if given widget exists * @param sWidget - widget name * @return bExists - true/false */ function widgetExists($sWidget) { global $sModulesPath; $sFilePath = $sModulesPath . $sWidget . "/xml/main.xml"; $bExists = file_exists($sFilePath) && filesize($sFilePath) > 0; return $bExists; } function getFlashConfig($sModule, $sApp, $aParamValues) { global $sModulesPath; global $sModulesUrl; global $sRayXmlUrl; if(isset($aModules)) unset($aModules); if($sModule != GLOBAL_MODULE) require($sModulesPath . $sModule . "/inc/header.inc.php"); require($sModulesPath . $sModule . "/inc/constants.inc.php"); $sHolder = $aInfo['mode'] == "as3" ? "holder_as3.swf" : "holder.swf"; if(isset($aModules[$sApp]['holder'])) $sHolder = $aModules[$sApp]['holder'] . ".swf"; $sHolder = $sModulesUrl . GLOBAL_MODULE . "/app/" . $sHolder; $iWidth = getSettingValue($sModule, $sApp . "_width"); if(empty($iWidth)) $iWidth = $aModules[$sApp]['layout']['width']; $iHeight = getSettingValue($sModule, $sApp . "_height"); if(empty($iHeight)) $iHeight = $aModules[$sApp]['layout']['height']; $aFlashVars = array( 'url' => $sRayXmlUrl, 'module' => $sModule, 'app' => $sApp ); foreach($aModules[$sApp]['parameters'] as $sParameter) { $aFlashVars[$sParameter] = isset($aParamValues[$sParameter]) ? $aParamValues[$sParameter] : process_db_input($_REQUEST[$sParameter]); } $aParams = array( 'allowScriptAccess' => "always", 'allowFullScreen' => "true", 'base' => $sModulesUrl . $sModule . "/", 'bgcolor' => "#" . getSettingValue(GLOBAL_MODULE, "backColor"), 'wmode' => getWMode() ); return array( 'holder' => $sHolder, 'width' => $iWidth, 'height' => $iHeight, 'flashVars' => $aFlashVars, 'params' => $aParams, 'modules' => $aModules ); } /** * Gets the embed code of necessary widget's application. * @param sModule - module(widget) name. * @param sApp - application name in the widget. * @param aParamValues - an associative array of parameters to be passed into the Flash object. */ function getEmbedCode($sModule, $sApp, $aParamValues) { global $sGlobalUrl; $sTemplate = ''; $aConfig = getFlashConfig($sModule, $sApp, $aParamValues); $aFlashVars = array(); foreach($aConfig['flashVars'] as $sKey => $sValue) $aFlashVars[] = $sKey . '=' . $sValue; $aConfig['params']['flashVars'] = implode('&', $aFlashVars); $aObjectParams = array(); $aEmbedParams = array(); foreach($aConfig['params'] as $sKey => $sValue) { $aObjectParams[] = ''; $aEmbedParams[] = $sKey . '="' . $sValue . '"'; } $sReturn = str_replace("#holder#", $aConfig['holder'], $sTemplate); $sReturn = str_replace("#width#", $aConfig['width'], $sReturn); $sReturn = str_replace("#height#", $aConfig['height'], $sReturn); $sReturn = str_replace("#objectParams#", implode("", $aObjectParams), $sReturn); $sReturn = str_replace("#embedParams#", implode(" ", $aEmbedParams), $sReturn); return $sReturn; } /** * Gets the content of necessary widget's application. * @param sModule - module(widget) name. * @param sApp - application name in the widget. * @param aParamValues - an associative array of parameters to be passed into the Flash object. * @param bInline - whether you want to have it with the full page code(for opening in a new window) * or only DIV with flash object (for embedding into the existing page). */ function getApplicationContent($sModule, $sApp, $aParamValues = array(), $bInline = false, $bEmbedCode = false, $sHtmlId = "") { global $sGlobalUrl; global $sHomeUrl; global $sRayHomeDir; global $sModulesUrl; global $sModulesPath; global $sFlashPlayerVersion; $sModule = isset($sModule) ? $sModule : process_db_input($_REQUEST['module']); $sApp = isset($sApp) ? $sApp : process_db_input($_REQUEST['app']); $sModuleStatus = getSettingValue($sModule, "status", "main"); if($sModuleStatus == WIDGET_STATUS_NOT_INSTALLED || $sModuleStatus == WIDGET_STATUS_DISABLED) return ""; $aConfig = getFlashConfig($sModule, $sApp, $aParamValues); $aModules = $aConfig['modules']; if(!isset($bInline))$bInline = $aModules[$sApp]['inline']; //--- Parameters for container's div ---// $sDivId = !empty($aModules[$sApp]['div']['id']) ? $aModules[$sApp]['div']['id'] : ''; if(!empty($sHtmlId)) $sDivId = $sHtmlId; if(empty($sDivId)) $sDivId = $sModule . '_' . $sApp; $sInnerDivId = $sDivId . "_" . time(); if(empty($sHtmlId)) $sHtmlId = "ray_" . $sModule . "_" . $sApp . "_object"; $sDivName = !empty($aModules[$sApp]['div']['name']) ? ' name="' . $aModules[$sApp]['div']['name'] . '"' : ''; if(count($aModules[$sApp]['div']['style'])) { $sDivStyle = ' style="'; foreach($aModules[$sApp]['div']['style'] as $sKey => $sValue) $sDivStyle .= $sKey . ':' . $sValue . ';'; $sDivStyle .= '"'; } else $sDivStyle=''; //--- Parameters for SWF object and reloading ---// $aParametersReload = array(); if(!isset($_GET["module"])) $aParametersReload[] = "module=" . $sModule; if(!isset($_GET["app"])) $aParametersReload[] = "app=" . $sApp; ob_start(); if(!$bInline) { ?>