[ Index ]

Source Code Reference for V1.00

title

Body

[close]

/modules/system/ -> systemconfig.php (source)

   1  <?php /* $Id: systemconfig.php 140 2008-04-05 15:34:35Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/system/systemconfig.php $ */
   2  
   3  if (!defined('W2P_BASE_DIR')) {
   4      die('You should not access this file directly.');
   5  }
   6  
   7  // check permissions
   8  $perms = &$AppUI->acl();
   9  if (!$perms->checkModule('system', 'edit')) {
  10      $AppUI->redirect('m=public&a=access_denied');
  11  }
  12  
  13  $w2Pcfg = new CConfig();
  14  
  15  // retrieve the system configuration data
  16  $rs = $w2Pcfg->loadAll('config_group');
  17  
  18  // retrieve any state parameters
  19  if (isset($_GET['tab'])) {
  20      $AppUI->setState('ConfigIdxTab', w2PgetParam($_GET, 'tab', null));
  21  }
  22  $tab = $AppUI->getState('ConfigIdxTab') !== null ? $AppUI->getState('ConfigIdxTab') : 0;
  23  $active = intval(!$AppUI->getState('ConfigIdxTab'));
  24  
  25  $titleBlock = new CTitleBlock('System Configuration', 'control-center.png', $m);
  26  $titleBlock->addCrumb('?m=system', 'system admin');
  27  $titleBlock->addCrumb('?m=system&a=addeditpref', 'default user preferences');
  28  $titleBlock->show();
  29  
  30  // prepare the automated form fields based on db system configuration data
  31  $output = null;
  32  $last_group = '';
  33  foreach ($rs as $c) {
  34  
  35      $tooltip = $AppUI->_($c['config_name'] . '_tooltip');
  36      // extraparse the checkboxes and the select lists
  37      $value = '';
  38      switch ($c['config_type']) {
  39          case 'select':
  40              // Build the select list.
  41              $entry = '<select class="text" name="w2Pcfg[' . $c['config_name'] . ']">';
  42              // Find the detail relating to this entry.
  43              $children = $w2Pcfg->getChildren($c['config_id']);
  44              foreach ($children as $child) {
  45                  $entry .= '<option value="' . $child['config_list_name'] . '"';
  46                  if ($child['config_list_name'] == $c['config_value']) {
  47                      $entry .= ' selected="selected"';
  48                  }
  49                  $entry .= '>' . $AppUI->_($child['config_list_name'] . '_item_title') . '</option>';
  50              }
  51              $entry .= '</select>';
  52              break;
  53          case 'checkbox':
  54              $extra = ($c['config_value'] == 'true') ? 'checked="checked"':
  55              '';
  56              $value = 'true';
  57              // allow to fallthrough
  58          default:
  59              if (!$value) {
  60                  $value = $c['config_value'];
  61              }
  62              $entry = '<input class="text" type="' . $c['config_type'] . '" name="w2Pcfg[' . $c['config_name'] . ']" value="' . $value . '" ' . $extra . '/>';
  63              break;
  64      }
  65  
  66      if ($c['config_group'] != $last_group) {
  67          $output .= '<tr><td colspan="2"><b>' . $AppUI->_($c['config_group'] . '_group_title') . '</b></td></tr>';
  68          $last_group = $c['config_group'];
  69      }
  70      $output .= '<tr><td class="item" width="20%">' . $AppUI->_($c['config_name'] . '_title') . '</td><td align="left">
  71  ' . $entry . w2PtoolTip($AppUI->_($c['config_name'] . '_title'), w2Phtmlspecialchars($tooltip), true) . w2PshowImage('log-info.gif') . w2PendTip() . '
  72                  <input class="button" type="hidden"  name="w2PcfgId[' . $c['config_name'] . ']" value="' . $c['config_id'] . '" />
  73              </td>
  74          </tr>
  75      ';
  76  
  77  }
  78  echo '<form name="cfgFrm" action="index.php?m=system&a=systemconfig" method="post">';
  79  ?>
  80  <input type="hidden" name="dosql" value="do_systemconfig_aed" />
  81  <table cellspacing="0" cellpadding="3" border="0" class="std" width="100%" align="center">
  82      <?php
  83  echo '<tr><td colspan="2">';
  84  if (is_dir(W2P_BASE_DIR . '/install')) {
  85      $AppUI->setMsg('You have not removed your install directory, this is a major security risk!', UI_MSG_ALERT);
  86      echo '<span class="error">' . $AppUI->getMsg() . '</span>';
  87  }
  88  echo $AppUI->_('syscfg_intro');
  89  echo '</td></tr>';
  90  
  91  echo $output;
  92  ?>
  93      <tr>
  94           <td align="right" colspan="2"><input class="button" type="submit" name="do_save_cfg" value="<?php echo $AppUI->_('Save'); ?>" /></td>
  95      </tr>
  96  </table></form>


Generated: Thu Jan 8 03:00:03 2009 Cross-referenced by PHPXref 0.7