19 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
 
   48     var $_confOptions = array();
 
   70     function id($format = 
'N')
 
   72         return $this->getVar(
'conf_id', $format);
 
   78     function conf_id($format = 
'')
 
   80         return $this->getVar(
'conf_id', $format);
 
   86     function conf_modid($format = 
'')
 
   88         return $this->getVar(
'conf_modid', $format);
 
   94     function conf_catid($format = 
'')
 
   96         return $this->getVar(
'conf_catid', $format);
 
  102     function conf_name($format = 
'')
 
  104         return $this->getVar(
'conf_name', $format);
 
  110     function conf_title($format = 
'')
 
  112         return $this->getVar(
'conf_title', $format);
 
  118     function conf_value($format = 
'')
 
  120         return $this->getVar(
'conf_value', $format);
 
  126     function conf_desc($format = 
'')
 
  128         return $this->getVar(
'conf_desc', $format);
 
  134     function conf_formtype($format = 
'')
 
  136         return $this->getVar(
'conf_formtype', $format);
 
  142     function conf_valuetype($format = 
'')
 
  144         return $this->getVar(
'conf_valuetype', $format);
 
  150     function conf_order($format = 
'')
 
  152         return $this->getVar(
'conf_order', $format);
 
  160     function getConfValueForOutput()
 
  162         switch ($this->getVar(
'conf_valuetype')) {
 
  164                 return intval($this->getVar(
'conf_value', 
'N'));
 
  167                 $value = @unserialize($this->getVar(
'conf_value', 
'N'));
 
  168                 return $value ? $value : array();
 
  170                 $value = $this->getVar(
'conf_value', 
'N');
 
  171                 return (
float) $value;
 
  174                 return $this->getVar(
'conf_value');
 
  176                 return $this->getVar(
'conf_value', 
'N');
 
  187     function setConfValueForInput(&$value, $force_slash = 
false)
 
  189         switch ($this->getVar(
'conf_valuetype')) {
 
  191                 if (!is_array($value)) {
 
  192                     $value = explode(
'|', trim($value));
 
  194                 $this->setVar(
'conf_value', serialize($value), $force_slash);
 
  197                 $this->setVar(
'conf_value', trim($value), $force_slash);
 
  200                 $this->setVar(
'conf_value', $value, $force_slash);
 
  210     function setConfOptions($option)
 
  212         if (is_array($option)) {
 
  213             $count = count($option);
 
  214             for(
$i = 0; 
$i < $count; 
$i++) {
 
  215                 $this->setConfOptions($option[
$i]);
 
  218             if (is_object($option)) {
 
  219                 $this->_confOptions[] =& $option;
 
  229     function &getConfOptions()
 
  231         return $this->_confOptions;
 
  240         $this->_confOptions = array();
 
  282             $sql = 
'SELECT * FROM ' . $this->db->prefix(
'config') . 
' WHERE conf_id=' . $id;
 
  286             $numrows = $this->db->getRowsNum(
$result);
 
  288                 $myrow = $this->db->fetchArray(
$result);
 
  307         if (!is_a(
$config, 
'xoopsconfigitem')) {
 
  316         foreach (
$config->cleanVars as $k => $v) {
 
  320             $conf_id = $this->db->genId(
'config_conf_id_seq');
 
  321             $sql = sprintf(
"INSERT INTO %s (conf_id, conf_modid, conf_catid, conf_name, conf_title, conf_value, conf_desc, conf_formtype, conf_valuetype, conf_order) VALUES (%u, %u, %u, %s, %s, %s, %s, %s, %s, %u)", $this->db->prefix(
'config'), $conf_id, $conf_modid, $conf_catid, $this->db->quoteString($conf_name), $this->db->quoteString($conf_title), $this->db->quoteString($conf_value), $this->db->quoteString($conf_desc), $this->db->quoteString($conf_formtype), $this->db->quoteString($conf_valuetype), $conf_order);
 
  323             $sql = sprintf(
"UPDATE %s SET conf_modid = %u, conf_catid = %u, conf_name = %s, conf_title = %s, conf_value = %s, conf_desc = %s, conf_formtype = %s, conf_valuetype = %s, conf_order = %u WHERE conf_id = %u", $this->db->prefix(
'config'), $conf_modid, $conf_catid, $this->db->quoteString($conf_name), $this->db->quoteString($conf_title), $this->db->quoteString($conf_value), $this->db->quoteString($conf_desc), $this->db->quoteString($conf_formtype), $this->db->quoteString($conf_valuetype), $conf_order, $conf_id);
 
  328         if (empty($conf_id)) {
 
  329             $conf_id = $this->db->getInsertId();
 
  331         $config->assignVar(
'conf_id', $conf_id);
 
  346         if (!is_a(
$config, 
'xoopsconfigitem')) {
 
  349         $sql = sprintf(
"DELETE FROM %s WHERE conf_id = %u", $this->db->prefix(
'config'), 
$config->getVar(
'conf_id'));
 
  367         $sql = 
'SELECT * FROM ' . $this->db->prefix(
'config');
 
  370             $sql .= 
' ORDER BY conf_order ASC';
 
  378         while ($myrow = $this->db->fetchArray(
$result)) {
 
  401         $sql = 
'SELECT * FROM ' . $this->db->prefix(
'config');
 
  409         list ($count) = $this->db->fetchRow(
$result);