Esempio n. 1
0
 public static function storeConfig()
 {
     $user = JFactory::getUser();
     if ($user->authorise('core.admin', 'com_tsmart')) {
         $installed = tsmartModelConfig::checktsmartInstalled();
         if ($installed) {
             tsmartModelConfig::installVMconfigTable();
             $confData = array();
             $confData['tsmart_config_id'] = 1;
             $confData['config'] = tsmConfig::$_jpConfig->toString();
             $confTable = tsmTable::getInstance('configs', 'Table', array());
             if (!$confTable->bindChecknStore($confData)) {
                 vmError('storeConfig was not able to store config');
             }
         }
     }
 }
 function installComplete($sample = false)
 {
     $this->checkPermissionForTools();
     if (tsmConfig::get('dangeroustools', true)) {
         if (!class_exists('com_tsmartInstallerScript')) {
             require VMPATH_ADMIN . DS . 'install' . DS . 'script.tsmart.php';
         }
         $updater = new com_tsmartInstallerScript();
         $updater->install(true);
         $model = $this->getModel('updatesMigration');
         $sid = $model->setStoreOwner();
         $msg = 'System and sampledata succesfull installed, user id of the mainvendor is ' . $sid;
         if (!class_exists('com_tsmart_allinoneInstallerScript')) {
             require VMPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_tsmart_allinone' . DS . 'script.vmallinone.php';
         }
         $updater = new com_tsmart_allinoneInstallerScript(false);
         $updater->vmInstall(true);
         if ($sample) {
             $model->installSampleData($sid);
         }
         if (!class_exists('tsmConfig')) {
             require_once VMPATH_ADMIN . '/models/config.php';
         }
         tsmartModelConfig::installVMconfigTable();
         //Now lets set some joomla variables
         //Caching should be enabled, set to files and for 15 minutes
         if (JVM_VERSION > 2) {
             if (!class_exists('ConfigModelCms')) {
                 require VMPATH_ROOT . DS . 'components' . DS . 'com_config' . DS . 'model' . DS . 'cms.php';
             }
             if (!class_exists('ConfigModelForm')) {
                 require VMPATH_ROOT . DS . 'components' . DS . 'com_config' . DS . 'model' . DS . 'application.php';
             }
             if (!class_exists('ConfigModelApplication')) {
                 require VMPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_config' . DS . 'model' . DS . 'application.php';
             }
         } else {
             if (!class_exists('ConfigModelApplication')) {
                 require VMPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_config' . DS . 'models' . DS . 'application.php';
             }
         }
         $jConfModel = new ConfigModelApplication();
         $jConfig = $jConfModel->getData();
         $jConfig['caching'] = 0;
         $jConfig['lifetime'] = 60;
         $jConfig['list_limit'] = 25;
         $jConfig['MetaDesc'] = 'tsmart works with Joomla! - the dynamic portal engine and content management system';
         $jConfig['MetaKeys'] = 'tsmart, vm2, joomla, Joomla';
         $app = JFactory::getApplication();
         $return = $jConfModel->save($jConfig);
         // Check the return value.
         if ($return === false) {
             // Save the data in the session.
             $app->setUserState('com_config.config.global.data', $jConfig);
             vmError(tsmText::sprintf('JERROR_SAVE_FAILED', 'installComplete'));
             //return false;
         } else {
             // Set the success message.
             //vmInfo('COM_CONFIG_SAVE_SUCCESS');
         }
     } else {
         $msg = $this->_getMsgDangerousTools();
     }
     $this->setRedirect('index.php?option=com_tsmart&view=updatesmigration&layout=insfinished', $msg);
 }