当前位置: 首页>>代码示例>>PHP>>正文


PHP VmConfig::installVMconfig方法代码示例

本文整理汇总了PHP中VmConfig::installVMconfig方法的典型用法代码示例。如果您正苦于以下问题:PHP VmConfig::installVMconfig方法的具体用法?PHP VmConfig::installVMconfig怎么用?PHP VmConfig::installVMconfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VmConfig的用法示例。


在下文中一共展示了VmConfig::installVMconfig方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Save the configuration record
  *
  * @author Max Milbers
  * @return boolean True is successful, false otherwise
  */
 function store(&$data, $replace = FALSE)
 {
     vRequest::vmCheckToken();
     //$data['active_languages'] = strtolower(strtr($data['active_languages'],'-','_'));
     //ATM we want to ensure that only one config is used
     $config = VmConfig::loadConfig(TRUE);
     if (!self::checkConfigTableExists()) {
         VmConfig::installVMconfig(false);
     }
     $browse_cat_orderby_field = $config->get('browse_cat_orderby_field');
     $cat_brws_orderby_dir = $config->get('cat_brws_orderby_dir');
     $config->setParams($data, $replace);
     $confData = array();
     $query = 'SELECT * FROM `#__virtuemart_configs`';
     $this->_db->setQuery($query);
     if ($this->_db->loadResult()) {
         $confData['virtuemart_config_id'] = 1;
     } else {
         $confData['virtuemart_config_id'] = 0;
     }
     $urls = array('assets_general_path', 'media_category_path', 'media_product_path', 'media_manufacturer_path', 'media_vendor_path');
     foreach ($urls as $urlkey) {
         $url = trim($config->get($urlkey));
         $length = strlen($url);
         if (strrpos($url, '/') != $length - 1) {
             $config->set($urlkey, $url . '/');
             vmInfo('Corrected media url ' . $urlkey . ' added missing /');
         }
     }
     //If empty it is not sent by the form, other forms do it by using a table to store,
     //the config is like a big xparams and so we check some values for this form manually
     /*$toSetEmpty = array('active_languages','inv_os','email_os_v','email_os_s');
     		foreach($toSetEmpty as $item){
     			if(!isset($data[$item])) {
     				$config->set($item,array());
     			}
     		}*/
     $checkCSVInput = array('pagseq', 'pagseq_1', 'pagseq_2', 'pagseq_3', 'pagseq_4', 'pagseq_5');
     foreach ($checkCSVInput as $csValueKey) {
         $csValue = $config->get($csValueKey);
         if (!empty($csValue)) {
             $sequenceArray = explode(',', $csValue);
             foreach ($sequenceArray as &$csV) {
                 $csV = (int) trim($csV);
             }
             $csValue = implode(',', $sequenceArray);
             $config->set($csValueKey, $csValue);
         }
     }
     $safePath = trim($config->get('forSale_path'));
     if (!empty($safePath)) {
         if (DS != '/' and strpos($safePath, '/') !== false) {
             $safePath = str_replace('/', DS, $safePath);
             vmInfo('Corrected safe path, replaced / by ' . DS);
             vmdebug('$safePath', $safePath);
         }
         $length = strlen($safePath);
         if (strrpos($safePath, DS) != $length - 1) {
             $safePath = $safePath . DS;
             vmInfo('Corrected safe path, added missing ' . DS);
         }
         $config->set('forSale_path', $safePath);
     } else {
         $safePath = JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'vmfiles';
         $exists = JFolder::exists($safePath);
         if (!$exists) {
             $created = JFolder::create($safePath);
             $safePath = $safePath . DS;
             if ($created) {
                 vmInfo('COM_VIRTUEMART_SAFE_PATH_DEFAULT_CREATED', $safePath);
                 /* create htaccess file */
                 $fileData = "order deny, allow\ndeny from all\nallow from none";
                 JLoader::import('joomla.filesystem.file');
                 $fileName = $safePath . DS . '.htaccess';
                 $result = JFile::write($fileName, $fileData);
                 if (!$result) {
                     VmWarn('COM_VIRTUEMART_HTACCESS_DEFAULT_NOT_CREATED', $safePath, $fileData);
                 }
                 $config->set('forSale_path', $safePath);
             } else {
                 VmWarn('COM_VIRTUEMART_WARN_SAFE_PATH_NO_INVOICE', JText::_('COM_VIRTUEMART_ADMIN_CFG_MEDIA_FORSALE_PATH'));
             }
         }
     }
     if (!class_exists('shopfunctions')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'shopfunctions.php';
     }
     $safePath = shopFunctions::checkSafePath($safePath);
     if (!empty($safePath)) {
         $exists = JFolder::exists($safePath . 'invoices');
         if (!$exists) {
             $created = JFolder::create($safePath . 'invoices');
             if ($created) {
                 vmInfo('COM_VIRTUEMART_SAFE_PATH_INVOICE_CREATED');
//.........这里部分代码省略.........
开发者ID:sergy444,项目名称:joomla,代码行数:101,代码来源:config.php

示例2: installComplete

 function installComplete($sample = false)
 {
     $data = JRequest::get('get');
     JRequest::setVar($data['token'], '1', 'post');
     JRequest::checkToken() or jexit('Invalid Token, in ' . JRequest::getWord('task'));
     $this->checkPermissionForTools();
     if (VmConfig::get('dangeroustools', true)) {
         if (!class_exists('com_virtuemartInstallerScript')) {
             require JPATH_VM_ADMINISTRATOR . DS . 'install' . DS . 'script.virtuemart.php';
         }
         $updater = new com_virtuemartInstallerScript();
         $updater->install(true);
         $model = $this->getModel('updatesMigration');
         $sid = $model->setStoreOwner();
         $model->setUserToPermissionGroup($sid);
         $msg = '';
         if (empty($errors)) {
             $msg = 'System succesfull restored and sampledata installed, user id of the mainvendor is ' . $sid;
         } else {
             foreach ($errors as $error) {
                 $msg .= $error . '<br />';
             }
         }
         if (!class_exists('com_virtuemart_allinoneInstallerScript')) {
             require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart_allinone' . DS . 'script.vmallinone.php';
         }
         $updater = new com_virtuemart_allinoneInstallerScript();
         $updater->vmInstall(true);
         if ($sample) {
             $model->installSampleData($sid);
         }
         VmConfig::installVMconfig();
         //Now lets set some joomla variables
         //Caching should be enabled, set to files and for 15 minutes
         if (!class_exists('ConfigModelApplication')) {
             require JPATH_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'] = 'VirtueMart works with Joomla! - the dynamic portal engine and content management system';
         $jConfig['MetaKeys'] = 'virtuemart, 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(vmText::sprintf('JERROR_SAVE_FAILED', $model->getError()));
             //return false;
         } else {
             // Set the success message.
             //vmInfo('COM_CONFIG_SAVE_SUCCESS');
         }
     } else {
         $msg = $this->_getMsgDangerousTools();
     }
     $this->setRedirect($this->redirectPath, $msg);
 }
开发者ID:sergy444,项目名称:joomla,代码行数:61,代码来源:updatesmigration.php


注:本文中的VmConfig::installVMconfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。