本文整理汇总了PHP中gcms::getVars方法的典型用法代码示例。如果您正苦于以下问题:PHP gcms::getVars方法的具体用法?PHP gcms::getVars怎么用?PHP gcms::getVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gcms
的用法示例。
在下文中一共展示了gcms::getVars方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: header
<?php
// widgets/textlink/admin_action.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// referer, admin
if (gcms::isReferer() && gcms::isAdmin() && (empty($_SESSION['login']['account']) || $_SESSION['login']['account'] != 'demo')) {
// ค่าที่ส่งมา
$action = gcms::getVars($_POST, 'action', '');
$id = gcms::getVars($_POST, 'id', '');
$value = gcms::getVars($_POST, 'value', 0);
if ($action == 'delete') {
$sql = "SELECT `logo` FROM `" . DB_TEXTLINK . "` WHERE `id` IN({$id}) AND logo != ''";
foreach ($db->customQuery($sql) as $item) {
@unlink(DATA_PATH . 'image/' . $item['logo']);
}
$db->query("DELETE FROM `" . DB_TEXTLINK . "` WHERE `id` IN({$id})");
} elseif ($action == 'published') {
$db->query("UPDATE `" . DB_TEXTLINK . "` SET `published`='{$value}' WHERE `id` IN({$id})");
} elseif ($action == 'move') {
// move menu
$max = 1;
foreach (explode(',', str_replace('user-', '', $_POST['data'])) as $i) {
$db->query("UPDATE `" . DB_TEXTLINK . "` SET `link_order`=" . $max . " WHERE `id`=" . (int) $i . " LIMIT 1");
$max++;
}
} elseif ($action == 'styles') {
// styles
include ROOT_PATH . 'widgets/textlink/styles.php';
// template
示例2: header
<?php
// admin/savestatus.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
$ret = array();
// referer, admin
if (gcms::isReferer() && gcms::isAdmin()) {
if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
$ret['error'] = 'EX_MODE_ERROR';
} else {
// action
$action = gcms::getVars($_POST, 'action', '');
// โหลด config ใหม่
$config = array();
if (is_file(CONFIG)) {
include CONFIG;
}
if ($action == 'config_status_add') {
if (!isset($config['member_status'][0])) {
$config['member_status'][0] = 'สมาชิก';
$config['color_status'][0] = '#006600';
}
if (!isset($config['member_status'][1])) {
$config['member_status'][1] = 'ผู้ดูแลระบบ';
$config['color_status'][1] = '#FF0000';
}
// เพิ่มสถานะสมาชิกใหม่
$config['member_status'][] = "{$lng['LNG_CLICK_TO']} {$lng['LNG_EDIT']}";
$config['color_status'][] = '#000000';
示例3: urlencode
}
// ค้นหาจาก printable_name และ iso
$search = $db->sql_trim_str($_GET, 'search');
if ($search != '') {
$qs[] = "(`printable_name` LIKE '%{$search}%' OR `iso` LIKE '%{$search}%')";
$url_query['search'] = urlencode($search);
}
$where = sizeof($qs) == 0 ? '' : ' WHERE ' . implode(' AND ', $qs);
// จำนวนสมาชิกทั้งหมด
$sql = "SELECT COUNT(*) AS `count` FROM `" . DB_COUNTRY . "`{$where}";
$count = $db->customQuery($sql);
// รายการต่อหน้า
$list_per_page = gcms::getVars('GET,COOKIE', 'count,country_listperpage', 30);
$list_per_page = max(10, $list_per_page);
// หน้าที่เลือก
$page = max(1, gcms::getVars($_GET, 'page', 1));
// ตรวจสอบหน้าที่เลือกสูงสุด
$totalpage = round($count[0]['count'] / $list_per_page);
$totalpage += $totalpage * $list_per_page < $count[0]['count'] ? 1 : 0;
$page = max(1, $page > $totalpage ? $totalpage : $page);
$start = $list_per_page * ($page - 1);
// คำนวณรายการที่แสดง
$s = $start < 0 ? 0 : $start + 1;
$e = min($count[0]['count'], $s + $list_per_page - 1);
$patt2 = array('/{SEARCH}/', '/{COUNT}/', '/{PAGE}/', '/{TOTALPAGE}/', '/{START}/', '/{END}/');
$replace2 = array($search, $count[0]['count'], $page, $totalpage, $s, $e);
// save ฟิลเตอร์ลง cookie
setCookie('country_order', $order, time() + 3600 * 24 * 365);
setCookie('country_zone', $zone, time() + 3600 * 24 * 365);
setCookie('country_listperpage', $list_per_page, time() + 3600 * 24 * 365);
// title
示例4: array
$ret = array();
// referer, member
if (gcms::isReferer() && gcms::canConfig($config, 'gallery_can_write')) {
if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
$ret['error'] = 'EX_MODE_ERROR';
} else {
$save = array();
$save2 = array();
$error = false;
$input = false;
// ค่าที่ส่งมา
$save['topic'] = $db->sql_trim_str($_POST, 'gallery_topic');
$save['detail'] = $db->sql_trim_str($_POST, 'gallery_detail');
$file = $_FILES['gallery_pic'];
// แก้ไขอัลบัม
$id = gcms::getVars($_POST, 'galleryId', 0);
// ตรวจสอบรายการและโมดูลที่เลือก
if ($id > 0) {
$sql = "SELECT C.`id`,C.`module_id`,M.`module`,G.`id` AS `image_id`,G.`image`";
$sql .= " FROM `" . DB_MODULES . "` AS M";
$sql .= " INNER JOIN `" . DB_GALLERY_ALBUM . "` AS C ON C.`module_id`=M.`id` AND C.`id`={$id}";
$sql .= " INNER JOIN `" . DB_GALLERY . "` AS G ON G.`album_id`=C.`id` AND G.`module_id`=M.`id` AND G.`count`='0'";
} else {
$sql1 = "SELECT MAX(`id`) FROM `" . DB_GALLERY_ALBUM . "` WHERE `module_id`=M.`id`";
$sql = "SELECT 0 AS `image_id`,M.`id` AS `module_id`,M.`module`,1+COALESCE(({$sql1}),0) AS `id` FROM `" . DB_MODULES . "` AS M";
}
$sql .= " WHERE M.`owner`='gallery' LIMIT 1";
$index = $db->customQuery($sql);
if (sizeof($index) == 1) {
$index = $index[0];
// ตรวจสอบค่าที่ส่งมา
示例5: implode
// id ที่ลบ
$ids[] = $item['id'];
}
if (sizeof($ids) > 0) {
$ids = implode(',', $ids);
// ลบอัลบัม
$db->query("DELETE FROM `" . DB_GALLERY_ALBUM . "` WHERE `id` IN ({$ids})");
// ลบรูปภาพ
$db->query("DELETE FROM `" . DB_GALLERY . "` WHERE `album_id` IN ({$ids})");
}
// กลับไปหน้าอัลบัม
$ret['error'] = 'DELETE_SUCCESS';
$ret['location'] = rawurlencode('index.php?module=gallery-album');
} elseif ($action == 'deletep') {
// ลบรูปในอัลบัม
$album_id = gcms::getVars($_POST, 'album', 0);
// ลบรูปภาพ
$sql = "SELECT `id`,`album_id`,`image` FROM `" . DB_GALLERY . "` WHERE `id` IN ({$ids}) AND `album_id`={$album_id}";
foreach ($db->customQuery($sql) as $item) {
// ลบรูปภาพ
@unlink(DATA_PATH . "gallery/{$item['album_id']}/{$item['image']}");
@unlink(DATA_PATH . "gallery/{$item['album_id']}/thumb_{$item['image']}");
$ret['remove' . $item['id']] = 'L_' . $item['id'];
}
// ลบ
$db->query("DELETE FROM `" . DB_GALLERY . "` WHERE `id` IN ({$ids}) AND `album_id`={$album_id}");
// อัปเดทจำนวนรูปภาพในอัลบัม
$sql = "SELECT COUNT(*) FROM `" . DB_GALLERY . "` WHERE `module_id`=C.`module_id` AND `album_id`={$album_id}";
$sql = "UPDATE `" . DB_GALLERY_ALBUM . "` AS C SET C.`count`=({$sql}) WHERE C.`id`={$album_id}";
$db->query($sql);
// คืนค่า
示例6: header
<?php
// widgets/twitter/admin_setup_save.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
// ตรวจสอบ referer และ admin
if (gcms::isReferer() && gcms::isAdmin()) {
// โหลด config ใหม่
$config = array();
if (is_file(CONFIG)) {
include CONFIG;
}
// ค่าที่ส่งมา
$config['twitter_height'] = max(100, gcms::getVars($_POST, 'twitter_height', 0));
$config['twitter_id'] = $db->sql_trim_str($_POST, 'twitter_id');
$config['twitter_name'] = $db->sql_trim_str($_POST, 'twitter_name');
$config['twitter_theme'] = $db->sql_trim_str($_POST, 'twitter_theme');
$config['twitter_border_color'] = strtoupper(trim($_POST['twitter_border_color']));
$config['twitter_link_color'] = strtoupper(trim($_POST['twitter_link_color']));
$config['twitter_count'] = gcms::getVars($_POST, 'twitter_count', 0);
// บันทึก config.php
if (gcms::saveconfig(CONFIG, $config)) {
$ret['error'] = 'SAVE_COMPLETE';
$ret['location'] = 'reload';
} else {
$ret['error'] = 'DO_NOT_SAVE';
}
// คืนค่า JSON
echo gcms::array2json($ret);
}
示例7: array
<?php
// widgets/shoutbox/index.php
if (defined('MAIN_INIT')) {
// default
$config['shoutbox_time'] = gcms::getVars($config, 'shoutbox_time', 5);
$config['shoutbox_lines'] = gcms::getVars($config, 'shoutbox_lines', 10);
$emoticon_dir = WEB_URL . '/widgets/shoutbox/smile';
$shoutbox = array();
$shoutbox[] = '<div id=shoutbox_div>';
$shoutbox[] = '<dl id=shoutbox_list></dl>';
$shoutbox[] = '<form id=shoutbox_frm method=post action=' . WEB_URL . '>';
$shoutbox[] = '<fieldset>';
$shoutbox[] = '<p><label for=shoutbox_sender>{LNG_FNAME}:</label><span><input type=text id=shoutbox_sender name=shoutbox_sender maxlength=20 size=15></span></p>';
$shoutbox[] = '<p><label for=shoutbox_txt>{LNG_SHOUTBOX_MESSAGE}:</label><span><input type=text id=shoutbox_txt name=shoutbox_txt maxlength=100 size=15 title="{LNG_SHOUTBOX_TEXT_TITLE}"></span></p>';
$shoutbox[] = '<p><label for=shoutbox_submit> </label><span><input class="button send" id=shoutbox_submit type=submit value="{LNG_SHOUTBOX_SEND}"><img src=' . $emoticon_dir . '/0.gif alt=emoticon class=nozoom></span></p>';
$shoutbox[] = '</fieldset>';
$shoutbox[] = '<p id=shoutbox_emoticon>';
$f = @opendir(ROOT_PATH . 'widgets/shoutbox/smile/');
if ($f) {
while (false !== ($text = readdir($f))) {
if (preg_match('/^([0-9]+)\\.gif$/', $text, $match)) {
$shoutbox[] = "<img src={$emoticon_dir}/{$match['1']}.gif alt={$match['1']} class=nozoom>";
}
}
closedir($f);
}
$shoutbox[] = '</p>';
$shoutbox[] = '</form>';
$shoutbox[] = '</div>';
$shoutbox[] = '<script>';
示例8: header
// admin/mailwrite_save.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../bin/inint.php';
$ret = array();
// ตรวจสอบ referer และ แอดมิน
if (gcms::isReferer() && gcms::isAdmin()) {
if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
$ret['error'] = 'EX_MODE_ERROR';
} else {
$error = false;
$input = false;
$save = array();
// id ของอีเมล์ (0 = ใหม่)
$id = gcms::getVars($_POST, 'email_id', 0);
if ($id > 0) {
// email ที่แก้ไข
$email = $db->getRec(DB_EMAIL_TEMPLATE, $id);
} else {
// อีเมล์ที่สร้างใหม่ สำหรับระบบจดหมายเวียน
$save['module'] = 'mailmerge';
$save['email_id'] = 0;
}
if ($id > 0 && !$email) {
$ret['error'] = 'ACTION_ERROR';
} else {
// ค่าที่ส่งมา
$save['language'] = $db->sql_trim_str($_POST, 'email_language');
$save['from_email'] = $db->sql_trim_str($_POST, 'email_from_email');
$save['subject'] = $db->sql_trim_str($_POST, 'email_subject');
示例9: array
$ret['ret_config_image_type'] = 'UPLOAD_TYPE_EMPTY';
$ret['input'] = 'config_image_type';
} else {
$ret['ret_config_image_type'] = '';
// โหลด config ใหม่
$config = array();
if (is_file(CONFIG)) {
include CONFIG;
}
// ค่าที่ส่งมา
$config['gallery_image_type'] = $_POST['config_image_type'];
$config['gallery_thumb_w'] = max(200, (int) $_POST['config_thumb_w']);
$config['gallery_thumb_h'] = max(200, (int) $_POST['config_thumb_h']);
$config['gallery_image_w'] = max(600, (int) $_POST['config_image_w']);
$config['gallery_cols'] = gcms::getVars($_POST, 'config_cols', 0);
$config['gallery_rows'] = gcms::getVars($_POST, 'config_rows', 0);
$config['gallery_can_write'] = isset($_POST['config_can_write']) ? $_POST['config_can_write'] : array();
$config['gallery_can_write'][] = 1;
$config['gallery_can_config'] = isset($_POST['config_can_config']) ? $_POST['config_can_config'] : array();
$config['gallery_can_config'][] = 1;
// บันทึก config.php
if (gcms::saveconfig(CONFIG, $config)) {
$ret['error'] = 'SAVE_COMPLETE';
$ret['location'] = 'reload';
} else {
$ret['error'] = 'DO_NOT_SAVE';
}
}
}
} else {
$ret['error'] = 'ACTION_ERROR';
示例10: array
<?php
// widgets/chat/admin_setup.php
if (MAIN_INIT == 'admin' && $isAdmin) {
// default
$config['chat_time'] = gcms::getVars($config, 'chat_time', 5);
$config['chat_history'] = gcms::getVars($config, 'chat_history', 7);
$config['chat_lines'] = gcms::getVars($config, 'chat_lines', 10);
// title
$title = $lng['LNG_CHAT_SETUP'];
$a = array();
$a[] = '<span class=icon-widgets>{LNG_WIDGETS}</span>';
$a[] = '{LNG_CHAT}';
// แสดงผล
$content[] = '<div class=breadcrumbs><ul><li>' . implode('</li><li>', $a) . '</li></ul></div>';
$content[] = '<section>';
$content[] = '<header><h1 class=icon-chat>' . $title . '</h1></header>';
$content[] = '<form id=setup_frm class=setup_frm method=post action=index.php>';
$content[] = '<fieldset>';
$content[] = '<legend><span>{LNG_CHAT}</span></legend>';
// chat_time
$content[] = '<div class=item>';
$content[] = '<label for=chat_time>{LNG_CHAT_TIME}</label>';
$content[] = '<span class="g-input icon-clock"><input type=number id=chat_time name=chat_time title="{LNG_CHAT_TIME_COMMENT}" value=' . $config['chat_time'] . '></span>';
$content[] = '<div class=comment id=result_chat_time>{LNG_CHAT_TIME_COMMENT}</div>';
$content[] = '</div>';
// chat_history
$content[] = '<div class=item>';
$content[] = '<label for=chat_history>{LNG_CHAT_HISTORY}</label>';
$content[] = '<span class="g-input icon-history"><input type=number id=chat_history name=chat_history title="{LNG_CHAT_HISTORY_COMMENT}" value=' . $config['chat_history'] . '></span>';
$content[] = '<div class=comment id=result_chat_history>{LNG_CHAT_HISTORY_COMMENT}</div>';
示例11: trim
$save['type'] = $db->sql_trim_str($_POST, 'textlink_type');
$save['text'] = $db->sql_trim($_POST, 'textlink_text');
$save['url'] = trim(gcms::getVars($_POST, 'textlink_url', ''));
$save['target'] = trim(gcms::getVars($_POST, 'textlink_target', ''));
if (isset($_POST['textlink_template']) && $_POST['textlink_type'] == 'custom') {
$save['template'] = preg_replace('/<\\?(.*?)\\?>/', '', trim($_POST['textlink_template']));
}
list($y, $m, $d) = explode('-', $_POST['textlink_publish_start']);
$save['publish_start'] = mktime(0, 0, 0, (int) $m, (int) $d, (int) $y);
if (isset($_POST['textlink_dateless']) && $_POST['textlink_dateless'] == 1) {
$save['publish_end'] = 0;
} else {
list($y, $m, $d) = explode('-', gcms::getVars($_POST, 'textlink_publish_end', '0-0-0'));
$save['publish_end'] = mktime(23, 59, 59, (int) $m, (int) $d, (int) $y);
}
$id = gcms::getVars($_POST, 'textlink_id', 0);
$logo = $_FILES['textlink_file'];
if ($id > 0) {
$sql = "SELECT `id` FROM `" . DB_TEXTLINK . "` WHERE `id`='{$id}' LIMIT 1";
} else {
$sql = "SELECT 1+COALESCE(MAX(`link_order`),0) FROM `" . DB_TEXTLINK . "`";
$sql = "SELECT ({$sql}) AS `link_order`,(1+COALESCE(MAX(`id`),0)) AS `id` FROM `" . DB_TEXTLINK . "`";
}
$textlink = $db->customQuery($sql);
if (sizeof($textlink) == 0) {
$ret['error'] = 'ACTION_ERROR';
$error = true;
} elseif (!preg_match('/^[a-z0-9]{1,}$/u', $save['name'])) {
$ret['ret_textlink_name'] = 'this';
$ret['input'] = 'textlink_name';
$error = true;
示例12: array
$index = $cache->get($sql);
if (!$index) {
$index = $db->customQuery($sql);
if (sizeof($index) > 0) {
$cache->save($sql, $index);
}
}
if (sizeof($index) == 0) {
$title = $lng['LNG_DATA_NOT_FOUND'];
$content = '<div class=error>' . $title . '</div>';
} else {
$index = $index[0];
// config
gcms::r2config($index['config'], $index);
// login
$login = gcms::getVars($_SESSION, 'login', array('id' => 0, 'status' => -1, 'email' => '', 'password' => ''));
// breadcrumbs
$breadcrumb = gcms::loadtemplate($index['module'], '', 'breadcrumb');
$breadcrumbs = array();
// หน้าหลัก
$breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
// breadcrumb ของ โมดูล
$m = $install_modules[$index['module']]['menu_text'];
$breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL($index['module']), $install_modules[$index['module']]['menu_tooltip'], $m == '' ? $index['module'] : $m, $breadcrumb);
// หมวด
$categories = array();
$categories[0] = '<option value=0>{LNG_NO_CATEGORY}</option>';
$sql = "SELECT `category_id`,`topic` FROM `" . DB_CATEGORY . "` WHERE `module_id`='{$index['module_id']}' ORDER BY `category_id`";
$list = $cache->get($sql);
if (!$list) {
$list = $db->customQuery($sql);
示例13: header
<?php
// modules/gallery/admin_upload_save.php
header("content-type: text/html; charset=UTF-8");
// inint
include '../../bin/inint.php';
$ret = array();
// referer, member
if (gcms::isReferer() && gcms::canConfig($config, 'gallery_can_write')) {
if (isset($_SESSION['login']['account']) && $_SESSION['login']['account'] == 'demo') {
$ret['error'] = 'EX_MODE_ERROR';
} else {
// อัลบัมที่อัปโหลด
$id = gcms::getVars($_POST, 'albumId', 0);
$sql = "SELECT MAX(`count`) FROM `" . DB_GALLERY . "` WHERE `module_id`=M.`id` AND `album_id`=C.`id`";
$sql = "SELECT C.`id`,C.`module_id`,({$sql}) AS `count` FROM `" . DB_MODULES . "` AS M";
$sql .= " INNER JOIN `" . DB_GALLERY_ALBUM . "` AS C ON C.`module_id`=M.`id` AND C.`id`={$id}";
$sql .= " WHERE M.`owner`='gallery' LIMIT 1";
$index = $db->customQuery($sql);
if (sizeof($index) == 1) {
$index = $index[0];
$save = array();
$save['module_id'] = $index['module_id'];
$save['album_id'] = $index['id'];
$save['last_update'] = $mmktime;
$save['count'] = (int) $index['count'] + 1;
// path เก็บไฟล์
$dir = DATA_PATH . "gallery/{$save['album_id']}/";
foreach ($_FILES as $file) {
// ตรวจสอบไฟล์อัปโหลด
$info = gcms::isValidImage($config['gallery_image_type'], $file);
示例14: array
// title
$title = $lng['LNG_REGISTER_TITLE'];
// breadcrumbs
$breadcrumb = gcms::loadtemplate('', '', 'breadcrumb');
$breadcrumbs = array();
// หน้าหลัก
$breadcrumbs['HOME'] = gcms::breadcrumb('icon-home', WEB_URL . '/index.php', $install_modules[$module_list[0]]['menu_tooltip'], $install_modules[$module_list[0]]['menu_text'], $breadcrumb);
// url ของหน้านี้
$breadcrumbs['MODULE'] = gcms::breadcrumb('', gcms::getURL('register'), $lng['LNG_REGISTER_TITLE'], $lng['LNG_REGISTER_TITLE'], $breadcrumb);
if (isset($config['custom_register']) && is_file(ROOT_PATH . $config['custom_register'])) {
// custom register form
include ROOT_PATH . $config['custom_register'];
} else {
// antispam
$register_antispamchar = gcms::rndname(32);
$_SESSION[$register_antispamchar] = gcms::rndname(4);
// แสดงฟอร์ม registerfrm.html
$patt = array('/{BREADCRUMS}/', '/<PHONE>(.*)<\\/PHONE>/isu', '/<IDCARD>(.*)<\\/IDCARD>/isu', '/<INVITE>(.*)<\\/INVITE>/isu', '/{(LNG_[A-Z0-9_]+)}/e', '/{ANTISPAM}/', '/{WEBURL}/', '/{MODAL}/', '/{INVITE}/');
$replace = array();
$replace[] = implode("\n", $breadcrumbs);
$replace[] = empty($config['member_phone']) ? '' : '\\1';
$replace[] = empty($config['member_idcard']) ? '' : '\\1';
$replace[] = empty($config['member_invitation']) ? '' : '\\1';
$replace[] = OLD_PHP ? '$lng[\'$1\']' : 'gcms::getLng';
$replace[] = $register_antispamchar;
$replace[] = WEB_URL;
$replace[] = gcms::getVars($_POST, 'action', '') != 'modal' ? 'false' : 'true';
$replace[] = gcms::getVars($_COOKIE, PREFIX . '_invite', '');
$content = gcms::pregReplace($patt, $replace, gcms::loadtemplate('member', 'member', 'registerfrm'));
}
}
示例15: array
if (gcms::isReferer() && gcms::canConfig($config, 'personnel_can_write')) {
if (empty($_SESSION['login']['account']) || $_SESSION['login']['account'] != 'demo') {
// ตรวจสอบ id
$ids = array();
foreach (explode(',', $_POST['id']) as $id) {
$ids[] = (int) $id;
}
// id ของ สมาชิกทั้งหมดที่ส่งมา
$ids = implode(',', $ids);
if ($_POST['action'] == 'delete' && $ids != '') {
$sql = "SELECT `picture` FROM `" . DB_PERSONNEL . "` WHERE `id` IN ({$ids}) AND `module_id`=";
$sql .= "(SELECT `id` FROM `" . DB_MODULES . "` WHERE `owner`='personnel')";
foreach ($db->customQuery($sql) as $item) {
@unlink(DATA_PATH . "personnel/{$item['picture']}");
}
// ลบ db
$sql = "DELETE FROM `" . DB_PERSONNEL . "` WHERE `id` IN ({$ids}) AND `module_id`=";
$sql .= "(SELECT `id` FROM `" . DB_MODULES . "` WHERE `owner`='personnel')";
$db->query($sql);
} elseif (preg_match('/^order_([0-9]+)$/', $_POST['id'], $match)) {
$ret["order_{$match['1']}"] = gcms::getVars($_POST, 'value', 0);
$db->edit(DB_PERSONNEL, $match[1], array('order' => $ret["order_{$match['1']}"]));
} else {
print_r($_POST);
}
}
} else {
$ret['error'] = 'ACTION_ERROR';
}
// คืนค่าเป็น JSON
echo gcms::array2json($ret);