XOOPS  2.6.0
update.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
23 {
25  // Copy old configs in new configs and delete old configs
26  $config_handler = $xoops->getHandlerConfig();
27  $criteria = new CriteriaCompo();
28  $criteria->add(new Criteria('conf_modid', 0));
29  $criteria->add(new Criteria('conf_catid', 5));
30  $configs = $config_handler->getConfigs($criteria);
31  $confcount = count($configs);
32  if ($confcount > 0) {
33  for ($i = 0; $i < $confcount; ++$i) {
34  $criteria = new CriteriaCompo();
35  $criteria->add(new Criteria('conf_modid', $module->getVar('mid')));
36  $criteria->add(new Criteria('conf_name', $configs[$i]->getvar('conf_name')));
37  $new_configs = $config_handler->getConfigs($criteria);
38  $new_confcount = count($new_configs);
39  if ($new_confcount > 0) {
40  for ($j = 0; $j < $new_confcount; ++$j) {
41  $obj = $config_handler->getConfig($new_configs[$j]->getvar('conf_id'));
42  }
43  $obj->setVar("conf_value", $configs[$i]->getvar('conf_value'));
44  $config_handler->insertConfig($obj);
45  $config_handler->deleteConfig($configs[$i]);
46  }
47 
48  }
49 
50  }
51  return true;
52 
53 }
$i
Definition: dialog.php:68
xoops_module_update_search(XoopsModule &$module)
Definition: update.php:22
static getInstance()
Definition: Xoops.php:160
getVar($key, $format= 's')
$module
Definition: update.php:55
if($_SERVER['REQUEST_METHOD']== 'POST') $config_handler
$configs
Definition: config.php:27
$criteria
$j
Definition: help.php:169
$xoops
Definition: update.php:23