Exemplo n.º 1
0
                $value = $config['member_status'][$match[2]];
            } elseif ($value == '' && $match[1] == 'color') {
                $value = $config['color_status'][$match[2]];
            } else {
                $name = $match[1] == 'name' ? 'member_status' : 'color_status';
                if (is_array($config[$name])) {
                    foreach ($config[$name] as $i => $item) {
                        $config[$name][$i] = $i == $match[2] ? $value : $item;
                    }
                } else {
                    $config[$name][$i] = $i == $match[2] ? $value : $item;
                }
            }
            // ส่งข้อมูลใหม่ไปแสดงผล
            $ret['edit'] = rawurlencode(htmlspecialchars($value));
            $ret['editId'] = $action;
        } else {
            $ret['error'] = 'ACTION_ERROR';
        }
        if (!isset($ret['error'])) {
            // บันทึก config.php
            if (!gcms::saveconfig(CONFIG, $config)) {
                $ret['error'] = 'DO_NOT_SAVE';
            }
        }
    }
} else {
    $ret['error'] = 'ACTION_ERROR';
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);
Exemplo n.º 2
0
                    }
                }
                // คืนค่า
                if (is_array($rss)) {
                    $ret['rss_url'] = rawurlencode($rss[0]);
                    $ret['rss_topic'] = rawurlencode($rss[1]);
                    $ret['rss_index'] = rawurlencode($rss[2]);
                    $ret['rss_rows'] = (int) $rss[3];
                    $ret['rss_cols'] = (int) $rss[4];
                    $ret['rss_id'] = $id;
                    $ret['input'] = 'rss_url';
                } else {
                    $ret['error'] = 'ACTION_ERROR';
                }
            } elseif ($_POST['action'] == 'move') {
                $rss_tabs = $config['rss_tabs'];
                $config['rss_tabs'] = array();
                $n = 1;
                foreach (explode(',', str_replace('L_', '', $_POST['data'])) as $id) {
                    $config['rss_tabs'][$n] = $rss_tabs[$id];
                    $n++;
                }
                gcms::saveconfig(CONFIG, $config);
            }
        } else {
            $ret['error'] = 'ACTION_ERROR';
        }
        // คืนค่า JSON
        echo gcms::array2json($ret);
    }
}