/** * Display the view */ function display() { $vName = JRequest::getVar('view'); if ($vName == 'version') { global $mainframe; $document =& JFactory::getDocument(); $vType = $document->getType(); $vLayout = 'about'; $mName = 'version'; // Get/Create the view $view =& $this->getView('version', $vType); // Get/Create the model $checkversion =& YOS_utility::getVersion(); $version = $checkversion['version']; $url = $checkversion['url']; $pc = $checkversion['productcode']; if ($model =& $this->getModel($mName, '', array('version' => $version, 'url' => $url, 'pc' => $pc))) { // Push the model into the view (as default) $view->setModel($model, true); } // Set the layout $view->setLayout($vLayout); //display view $view->display(); return; } if ($vName) { parent::display(); return; } $view = $this->getView('cpanel', 'html'); $view->display(); }
function doupdate() { global $mainframe; // Get/Create the model $checkversion =& YOS_utility::getVersion(); $version = $checkversion['version']; $url = $checkversion['url']; $pc = $checkversion['productcode']; $config =& JComponentHelper::getParams('com_yos_resources_manager'); $config_lic = $config->get('licence'); $engine = new AutoUpdateEngine($url, $pc, $version, JURI::root(), $config_lic); if (!($autoupdate =& $engine->getInstance())) { $mainframe->redirect('index.php?option=com_yos_resources_manager&view=version'); return false; } $autoupdate->upgradeFile(); $autoupdate->upgradeSql(); $autoupdate->cleanFileUpdate(); $mainframe->redirect('index.php?option=com_yos_resources_manager&view=version', $autoupdate->getReport()); }