0) { foreach($oldArray as $version) if ($version[$i]>$maxVersion) $maxVersion = $version[$i]; } if (count($oldArray)>0) { foreach($oldArray as $version) if ($version[$i]==$maxVersion) $newArray[] = $version; } $oldArray = $newArray; } if (count($oldArray)>0) return implode(".",$oldArray[0]); else return FALSE; } function GetPluginData($pluginName,&$pluginVersion,&$pluginPath) { $db =& VoxelCareDB::getDatabase(); $userId = LegacyHelper::getUserId(); if (!$userId) $userId = 0; $sql = "SELECT p.id id,p.path path,p.defaultversion defaultversion, up.version, up.id idup FROM #__vxc_plugin p LEFT JOIN #__vxc_userplugin up ON up.plugin = p.id AND up.user = $userId WHERE p.name = ".$db->Quote($pluginName); $db->setQuery($sql); $plugin = $db->loadObject(); if ($plugin) { $pluginVersion = $plugin->version; if (!$plugin->idup) $pluginVersion = $plugin->defaultversion; if (!$pluginVersion) { // cogemos la ultima version disponible del plugin $modelService =& $this->getModel("voxelservice"); $commondir = $modelService->GetCommonDir(); $versions = array(); $res = @opendir( LegacyHelper::getCommonParentFolder().$commondir."/".$plugin->path); if ($res!==FALSE) { while(($file = @readdir($res))!==FALSE) { $posIni = strpos($file,"_"); if ($posIni===FALSE) continue; $posFin = strpos($file,".vxp",$posIni+1); if ($posFin===FALSE) continue; $version = substr($file,$posIni+1,$posFin - $posIni-1); $versions[] = explode(".",$version); } @closedir($res); } $pluginVersion = $this->GetLastVersion($versions); } $pluginPath = $plugin->path; } } function display($tpl = null) { $document = & JFactory::getDocument(); $headerstuff=$document->getHeadData(); reset($headerstuff['styleSheets']); foreach($headerstuff['styleSheets'] as $key=>$value) unset($headerstuff['styleSheets'][$key]); $document->setHeadData($headerstuff); $css=" body {width:100%; height:100%; overflow:hidden, margin:0} html {width:100%; height:100%; overflow:hidden}"; $document->addStyleDeclaration($css); /* $this->loadHelper('vxcloadcsshelper'); $cssHelper = new VxcLoadCssHelper(); $cssHelper->loadCss(); */ $debugPlugin = 'false'; if (JRequest::getVar('debugPlugin')) $debugPlugin = 'true'; $modelService =& $this->getModel("voxelservice"); $commondir = $modelService->GetCommonDir(); $loaderrelpath = $commondir.'/voxelloader'; $loaderpath= LegacyHelper::getCommonParentFolder(). $loaderrelpath; $loadername= 'VoxelLoader'; $loaderversion = strtr(trim(file_get_contents($loaderpath.'/'.$loadername.'.ver')),".",","); $dueditorname= JRequest::getVar('plugin'); $this->GetPluginData($dueditorname,$dueditorversion,$dueditorpath); $jsDir = 'components/com_vxc/assets/js/'; $document->addScript($jsDir."base64.js"); $document->addScript($jsDir."commonAPI.js"); $document->addScript($jsDir."vpluginloader.js"); $document->addScript(JURI::base().'components/com_vxc/assets/js/attachevent.js'); $document->addScript(JURI::base().'components/com_vxc/assets/js/loaderLauncher.js'); $modelUser =& $this->getModel('user'); $allowEXE = 'true'; $userObj =& $modelUser->getData(); $forceEXE = ($modelUser->CheckPrivilege('Force external loader'))?'true':'false'; $jsParams = ''; $link = "vxp://run?"; foreach($_GET as $key => $value) { $jsParams.= "params['$key']='$value';"; $link.= "$key=$value&"; } if ($dueditorname=='BB1v2Plugin') { $jsParams.="params['lengthSupplement']='8.3';"; $link.="&lengthSupplement=8.3&"; } $jsParams.= "params['server']='213.56.170.175';"; $link.="version=".$dueditorversion. "&plugin=".$commondir."/".$dueditorpath."/".$dueditorname. "&caption=".$dueditorname. "&server=213.56.170.175". "&userId=".$userObj->id. "&debugPlugin=".($debugPlugin=='true'?1:0); if (LegacyHelper::getNewMode()) { $link .="&remoteURL=".urlencode("joomla/index.php?option=com_vxc&controller=voxelservice&format=raw&task=run"); } $link=str_replace('&',';',$link); $initializationAX = "gLoader.InitComm('index.php?option=com_vxc&task=run&controller=voxelservice&format=raw',30); gLoader.Container = 'spanLoader'; gLoader.File = \"". $this->escape($loaderrelpath).'/'.$this->escape($loadername).'.cab' ."\"; gLoader.Version = \"".$this->escape($loaderversion)."\"; gLoader.Name = gLoader.Id = 'vxloader'; gLoader.PluginVersion = \"".$this->escape($dueditorversion)."\"; gLoader.PluginName = \"".$this->escape($commondir."/".$dueditorpath)."/".$this->escape($dueditorname)."\"; gLoader.ChunkSize = '256'; gLoader.Debug = ".$debugPlugin."; gLoader.OnLoad = OnLoad; gLoader.OnPluginLoad = OnPluginLoad; gLoader.FatalMessage = \"".$this->escape(JText::_('ACTIVEX_CANNOT_LOAD_MESSAGE'))."\"; gLoader.Init(null,null,OnPluginClose); "; $initializationEXE = "var link = \"".$this->escape($link)."\"; var sizes = GetClientSize(); curw=sizes.width; curh=sizes.height; link += \";width=\"+curw+\";height=\"+curh+\";\"; link += \"cookies=\"+escape(document.cookie); VoxelLoader_Launch(LoaderCallback, 'imgResponse',link);"; $js =" var width,height; function GetClientSize() { var w = 0; var h = 0; //IE if(!window.innerWidth) { //strict mode if(!(document.documentElement.clientWidth == 0)) { w = document.documentElement.clientWidth; h = document.documentElement.clientHeight; } //quirks mode else { w = document.body.clientWidth; h = document.body.clientHeight; } } //w3c else { w = window.innerWidth; h = window.innerHeight; } return {width:w,height:h}; } function UpdateSize() { var curw,curh,str; var sizes = GetClientSize(); curw=sizes.width; curh=sizes.height; if (curw<1) curw=1; if (curh<1) curh=1; if (curw!=width || curh!=height) { gLoader.SetSize(curw,curh); } width=curw; height=curh; } function LoaderCallback(res) { if(res==ST_LOADERLAUNCHER_SUCCEEDED) { } else if(res==ST_LOADERLAUNCHER_FAILED) { var text=document.getElementById(\"myText\"); if (text) { text.innerHTML = \"Loader is NOT available, please click here to download the installer.\"; text.style.color=\"red\"; } } else if(res==ST_LOADERLAUNCHER_CLOSED) { OnPluginClose(null); } } function OnPluginClose(loader) { if (window.parent && window.parent.OnPluginClose) window.parent.OnPluginClose(); } var browser = VoxelLoader_GetBrowser(); var isEXELoader = (browser != BROWSER_INTERNET_EXPLORER || $forceEXE) && $allowEXE; function Init() { if (isEXELoader) { $initializationEXE } else { $initializationAX } } function Destroy() { if (!isEXELoader) gLoader.Destroy(); } function OnLoad(loader) { UpdateSize(); setInterval('UpdateSize()',500); } function OnPluginLoad(loader) { var params = new Array(); $jsParams loader.ToPlugin('Init', params, 'Init', null); } addLoadEvent(function() { Init(); }); AttachEvent(window,'onunload', function() { Destroy(); }); AttachEvent(window,'onkeydown', function() { return KillBackSpace(event); }); "; $document->addScriptDeclaration($js); parent::display($tpl); }// function }// class ?>