Ejemplo n.º 1
0
            // new row
            $row = '<dd id="config_category_' . $id . '">';
            $row .= '<span class="no">[' . $save['category_id'] . ']</span>';
            $row .= '<span class="icon-delete" id="config_category_delete_' . $id . '" title="' . $lng['LNG_DELETE'] . ' ' . $text . '">&nbsp;</span>';
            $row .= $text . ' <span id="config_category_name_' . $id . '" title="' . $lng['LNG_CLICK_TO'] . ' ' . $lng['LNG_EDIT'] . '">' . $topic[LANGUAGE] . '</span>';
            $row .= '</dd>';
            $ret['data'] = rawurlencode($row);
            $ret['newId'] = "config_category_" . $id;
        } elseif (preg_match('/^config_(category)_delete_([0-9]+)$/', $action, $match)) {
            // ลบหมวดหมู่
            $db->query("DELETE FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$module_id}' AND `id`='{$match['2']}' LIMIT 1");
            // รายการที่ลบ
            $ret['del'] = "config_{$match['1']}_" . $match[2];
        } elseif (preg_match('/^config_(category)_name_([0-9]+)$/', $action, $match)) {
            // แก้ไขชื่อหมวดหมู่
            $topic[LANGUAGE] = $db->sql_trim_str(gcms::oneLine($_POST['value']));
            $sql = "SELECT `id` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$module_id}' AND `id`='{$match['2']}' LIMIT 1";
            $category = $db->customQuery($sql);
            if (sizeof($category) == 1) {
                $db->edit(DB_CATEGORY, $category[0]['id'], array('topic' => gcms::array2Ser($topic)));
                // ส่งข้อมูลใหม่ไปแสดงผล
                $ret['edit'] = rawurlencode($topic[LANGUAGE]);
                $ret['editId'] = $action;
            }
        }
    }
} else {
    $ret['error'] = 'ACTION_ERROR';
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);
Ejemplo n.º 2
0
                     $input = $key;
                     $error = 'DO_NOT_UPLOAD';
                 } else {
                     $ret["icon_{$k}"] = rawurlencode(DATA_URL . "board/{$icon[$k]}?{$mmktime}");
                 }
             }
         }
     }
     if (sizeof($icon) > 0) {
         $save['icon'] = gcms::array2Ser($icon);
     }
 }
 if (!$error) {
     $save['category_id'] = $category_id;
     $save['topic'] = gcms::array2Ser($topic);
     $save['detail'] = gcms::array2Ser($detail);
     // config
     $cfg = array();
     $can_post = isset($_POST['category_can_post']) ? $_POST['category_can_post'] : array();
     $can_post[] = 1;
     $can_view = gcms::getVars($_POST, 'category_can_view', array());
     $can_view[] = 1;
     $can_reply = gcms::getVars($_POST, 'category_can_reply', array());
     $can_reply[] = 1;
     $moderator = gcms::getVars($_POST, 'category_moderator', array());
     $moderator[] = 1;
     $img_upload_size = gcms::getVars($_POST, 'category_img_upload_size', 0);
     $img_law = gcms::getVars($_POST, 'category_img_law', 0);
     $img_upload_type = @implode(',', $_POST['category_img_upload_type']);
     $cfg[] = 'can_post=' . implode(',', $can_post);
     $cfg[] = 'can_view=' . implode(',', $can_view);