function execute() { $Id = __post("Id"); if ((int) $Id > 0) { $token = __post("token"); $data = $this->getListDetail($Id); foreach ($data as $key => $value) { ${$key} = $value; } } $list_form = new XTemplate('Config/HospitalAdd.html'); $arr_info_province_id = $this->getListProvince(); $Attr_province_id = array('rel' => '{Require:\'R\',Alert:\'Vui lòng chọn tỉnh thành \'}', 'style' => ''); $txt_province_id = addSelectList2('province_id', $arr_info_province_id, NULL, $Attr_province_id, $list_form, $province_id); $arr_info_status = array(1 => 'Active', 0 => 'InActive'); $Attr_status = array('rel' => '{Require:\'R\',Alert:\'Vui lòng chọn trạng thái \'}', 'style' => ''); $txt_status = addSelectList2('status', $arr_info_status, NULL, $Attr_status, $list_form, $status); $Attr_pstname = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập tên bệnh viện \'}', 'style' => 'width:200px;'); $txt_pstname = addInput('text', 'name', $name, $Attr_pstname, $list_form); $Attr_pstorder = array('style' => ''); $txt_pstorder = addInput('text', 'order', $order, $Attr_pstorder, $list_form); $list_form->assign('Id', $Id); $list_form->assign('token', $token); $list_form->parse('main'); $html = $list_form->out_return('main'); die($html); }
function add_comment() { global $db, $fullsite, $cla_cid, $cla_nid, $cla_site, $ts_config; $result = array('result' => -1, 'data' => ''); if (!is_login()) { die(json_encode($result)); } $user_info = get_user_info_login(); $user_id = get_userid(); $comment = __post('comment'); $post_id = (int) __post('post_id'); $token = __post('token'); $tokenCheck = md5(md5($post_id)); if ($token != $tokenCheck) { $result['result'] = -2; die(json_encode($result)); } $sSQL = " insert into ntk_forum_comments(user_id,post_id,content,`status`,create_date)\n\t\t\t\tvalues({$user_id},{$post_id},'{$comment}',0,NOW() )\n\t\t\t"; $resultSQL = $db->query($sSQL, true, "Query failed"); $result['result'] = 1; $html_comment = '<div class="forum_comment ' . $class . '">'; $html_comment .= '<div class="forum_comment_header">'; $html_comment .= '<span class="forum_comment_full_name">' . $user_info['full_name'] . '</span> '; $html_comment .= '<span class="forum_comment_date">' . date("d/m/Y H:i:s") . '</span><br>'; $html_comment .= '</div>'; $html_comment .= '<div class="forum_comment_content">'; $html_comment .= ' <pre>' . $comment . '<pre>'; $html_comment .= '</div>'; $html_comment .= '</div>'; $result['data'] = $html_comment; die(json_encode($result)); }
function execute() { $type = __post('tp'); switch ($type) { case 'del_file': $id = __post('id'); if ($id > 0) { $sSQL = "delete from ntk_new_files where id = " . (int) $id; $result = $this->db->query($sSQL, true, "Query failed"); die("1"); } die("-1"); break; case '': break; } }
function setList($CaptchaText, $filter, $conpany_list) { $result = NULL; $PageSize = 10; $this->PageIndex = isset($_POST["page"]) ? $_POST["page"] : 1; if ($_POST['ddlPageSize'] != '') { $PageSize = $_POST['ddlPageSize']; } $this->PageSize = $PageSize; $_FlgExport = false; $mode_inpvl = __post('mode_inpvl'); if ($mode_inpvl == 'EXPORT') { $PageSize = 0; $_FlgExport = true; } $_Table = 'ws_rf_absent_list'; $_KeyField = 'absent_list_id'; // ===== order =============/ $_SortOrderBy = $_POST["_SortOrderBy"]; $_OrderDirection = $_POST["_OrderDirection"]; if (trim($_SortOrderBy) == '' || $_FlgExport) { $_OrderBy = 'name'; $_OrderDirection = 'asc'; } else { $_OrderBy = $this->arrSortHeader[$_SortOrderBy]; } // ===== order =============/ $_Where = " and 1=1 and status <> -13 " . $filter; try { $_dblist = ''; $i = 0; $start = ($this->PageIndex - 1) * $PageSize; if ($mode_inpvl == 'EXPORT') { $sSQL = "select t1.*,t2.name as province_name from ntk_hospital t1 \n\t\t\t\t\tleft join ntk_province t2 on t1.province_id = t2.id\n\t\t\t\t\twhere 1=1 " . $_Where . " order by " . $_OrderBy . " " . $_OrderDirection; } else { $sSQLTotal = "select count(t1.id) as TotalRecord from ntk_hospital t1\n\t\t\t\t\tleft join ntk_province t2 on t1.province_id = t2.id\n\t\t\t\t\twhere 1=1 " . $_Where; $sSQL = "select t1.*,t2.name as province_name \n\t\t\t\t\tfrom ntk_hospital t1 \n\t\t\t\t\tleft join ntk_province t2 on t1.province_id = t2.id\n\t\t\t\t\twhere 1=1 " . $_Where . " order by " . $_OrderBy . " " . $_OrderDirection . " limit " . $start . "," . $PageSize; $resultTotal = $this->db->query($sSQLTotal, true, "Query failed"); $aRTotal = $this->db->fetchByAssoc($resultTotal); $this->TotalRecord = $aRTotal['TotalRecord']; $this->TotalPage = intval($this->TotalRecord / $PageSize + ($this->TotalRecord % $PageSize > 0 ? 1 : 0)); } $result = $this->db->query($sSQL, true, "Query failed"); $tooltip = ''; while ($aR = $this->db->fetchByAssoc($result)) { $_RowNum = $aR['RowNum']; $_TotalRecord = $aR['TotalRecord']; $STT = $i + ($this->PageIndex - 1) * $PageSize + 1; $id = $aR['id']; $_dblist .= '<tr>'; if ($mode_inpvl == 'EXPORT') { $_dblist .= '<td style="text-align:center" width=50>' . $STT . '</td>'; } else { $inp_del = '<div title="" class="status_box ' . $status_class_name . '">'; $tokenDelete = $this->md5sum($this->prefix['delete'] . $id); $inp_del .= ' <input type=checkbox value="' . $id . '|' . $tokenDelete . '" name="chk[]" id="chk_' . $STT . '">'; $tokenEdit = $this->md5sum($this->prefix['edit'] . $id); $inp_del .= ' <img src="../images/edit2.png" width=16 height=16 style="cursor:pointer;margin-right:5px" onclick="dg_add(\'Config\',\'HospitalAdd\',' . $id . ',\'' . $tokenEdit . '\',\'Cập nhật thông tin\',400,300)">'; $inp_del .= '<img src="../images/delete.png" width=16 height=16 style="cursor:pointer;" onclick="dg_del(' . $id . ',\'' . $tokenDelete . '\',' . $STT . ',\'' . $CaptchaText . '\')">'; $inp_del .= '</div>'; $_dblist .= '<td style="text-align:left;width:60px">' . $inp_del . '</td>'; } if ($mode_inpvl != 'EXPORT') { $arr_status = array(1 => '<div class="icon_status_success"></div>', 0 => '<div class="icon_status_fail"></div>'); } else { $arr_status = array(1 => 'Active', 0 => 'InActive'); } foreach ($this->arrHeader as $field => $name) { if ($field == 'status') { $aR[$field] = $arr_status[(int) $aR[$field]]; } if ($field != 'STT') { $_dblist .= '<td style="text-align:left">' . $aR[$field] . '</td>'; } } $_dblist .= '</tr>'; $i++; } if ($i == 0) { if ($this->TotalRecord == 0) { $_dblist .= '<tr><td colspan=100>Không tìm thấy thông tin</td></tr>'; } } else { } } catch (PDOException $ex) { } $list[0] = $_dblist; return $list; }
<?php require './config.php'; $action = __post('action'); DB::setBait('zhq', array('127.0.0.1', 'weiche_web', 'root', '000000', 3306)); DB::setHarpoon('zhq'); //加载 if ($action == 'load') { $aa = DB::getAll('select * from weiche_ads'); //获取 表 中的所有数据 echo json_encode($aa); exit; } //添加 if ($action == 'add') { $arr['baidu_id'] = __post('baidu_id'); $arr['title'] = __post('title'); $arr['click_times'] = __post('click_times'); $arr['weiche_link'] = __post('weiche_link'); if ($arr['baidu_id'] == "" || $arr['title'] == "") { die("notfount"); } $sql = 'INSERT INTO `weiche_ads` (`baidu_id`,`title`,`weiche_link`,`click_times`) VALUES ( ?,?,?,?)'; DB::exec($sql, array($arr['baidu_id'], $arr['title'], $arr['weiche_link'], $arr['click_times'])); $arr = array('baidu_id' => $arr['baidu_id'], 'title' => $arr['title'], 'click_times' => $arr['click_times']); echo json_encode($arr); exit; } include UI . 'ads-drivers2.ui';
function page_news($home = false, $search = false) { global $db, $fullsite, $cla_cid, $cla_nid, $cla_site, $ts_config; $curPage = $_POST['page']; if ((int) $curPage <= 0) { $curPage = 1; } $lang = '_' . get_language(); if ($home) { $title_page = get_lang('home'); } if ($search == true && __post('txt_search') != '') { $filter_search = " and (keyword_vi like '%" . __post('txt_search') . "%' or keyword_en like '%" . __post('txt_search') . "%' )"; if ($search == true && $has_data == false) { $title_page = get_lang('search_result'); } } if ($home == true || $search == true) { echo '<div class="group_area"> <div style="background-color:#71baf1;" class="lft-title"> ' . $title_page . ' </div> <div class="group_content">'; } if ((int) $cla_cid > 0 || $home) { $PageSize = (int) $ts_config['max_news_page']; $from = ($curPage - 1) * $PageSize; $limit = $PageSize; $sqlTotal = "SELECT count(*) as TotalRecord FROM ntk_news WHERE status = 1"; if ((int) $cla_cid > 0) { $sqlTotal .= " and cid=" . $cla_cid . " "; } if ((int) $cla_nid > 0) { $sqlTotal .= " AND id<=" . $cla_nid; } $sqlTotal .= $filter_search; if ($home) { $sqlTotal .= " AND show_index = 1 "; } //echo $sqlTotal; $result = $db->query($sqlTotal, true, "Query failed"); $TotalRecord = 0; if ($aR = $db->fetchByAssoc($result)) { $TotalRecord = (int) $aR['TotalRecord']; } $has_data = false; if ($TotalRecord > 0) { $TotalPage = intval($TotalRecord / $PageSize + ($TotalRecord % $PageSize > 0 ? 1 : 0)); $paging = Paging2($TotalPage, $curPage, 'form1'); $sql = "SELECT t1.*,t2.menu_name" . $lang . " FROM ntk_news t1\n\t\t\t\t\tleft join ntk_menus t2 on t1.cid = t2.menu_id\n\t\t\t\tWHERE t1.status = 1"; if ((int) $cla_cid > 0) { $sql .= " and t1.cid=" . $cla_cid . " "; } if ((int) $cla_nid > 0) { $sql .= " AND t1.id = " . $cla_nid; } if ($home) { $sql .= " AND t1.show_index = 1 "; } $sql .= $filter_search; $sql .= "ORDER BY news_order ASC,id ASC \tLIMIT " . $from . "," . $limit . " "; //echo $sql; $result = $db->query($sql, true, "Query failed"); echo '<form action="" name="form1" id="form1" method="POST"> <input type="hidden" value="1" name="page" id="page"/> '; $stt = 0; while ($aR = $db->fetchByAssoc($result)) { if ($aR['title' . $lang] != '' && $aR['short' . $lang] != '') { if ($stt == 0) { if ($home == false && $search == false) { echo '<div class="group_area"><div style="background-color:#71baf1;" class="lft-title">' . $aR['menu_name' . $lang] . '</div><div class="group_content">'; } } $has_data = true; $title_url = ''; $title_url = fnStrConvert($aR['title' . $lang]); $title_url = str_replace(" ", '-', $title_url); echo '<div class="news_title"><a href="' . $fullsite . '/' . (int) $aR['cid'] . '/' . (int) $aR['id'] . '/' . $title_url . '.html">' . $aR['title' . $lang] . '</a></div>'; echo '<div><div class="news_date">' . date2vndate($aR['create_date']) . '</div><div class="news_download">'; $sql = " select t1.*,t2.file_type_name,t2.file_type_icon \n\t\t\t\t\t\t\t\tfrom ntk_new_files t1\n\t\t\t\t\t\t\t\tleft join ntk_file_type t2 on t1.file_type_id = t2.file_type_id\n\t\t\t\t\t\t\t\twhere t1.new_id = " . (int) $aR['id'] . "\n\t\t\t\t\t\t"; $result_file = $db->query($sql, true, "Query failed"); $i = 0; while ($aR_file = $db->fetchByAssoc($result_file)) { if ($i == 0) { echo '<span class="download_file_title">Tải file tại đây</span> '; } if ($aR_file['require_login'] == 1 && !is_login()) { $href = 'javascript:notLogin();'; } else { $href = $ts_config['site_url_download_file'] . $aR_file['file_path']; } if ($i > 0) { echo ' | '; } //$urlre = $sugar_config['site_url_download_file']."/download_file_case.php?fn=".$filePath; //header('location:'.$urlre.''); //die(); echo '<a href="' . $href . '"><img src="' . $fullsite . '/images/' . $aR_file['file_type_icon'] . '"></a>'; $i++; } echo '</div></div><br>'; echo '<div class="news_short"><div style="width:25px; float:left;"> </div>' . html_entity_decode($aR['short' . $lang]) . ' <a href="' . $fullsite . '/' . (int) $aR['cid'] . '/' . (int) $aR['id'] . '/' . $title_url . '.html">' . get_lang('text_detail') . '</a></div>'; echo '<hr size=2 style="color:#cccccc">'; $stt++; } } if ($has_data == true) { echo '<div style="margin-top:10px;margin-bottom:10px;">' . $paging . '</div>'; } } if ($search == true && $has_data == false) { echo '<div style="">' . get_lang('search_no_result') . '</div>'; } echo "</form1>"; echo "</div></div>"; } }
function login() { global $db, $fullsite, $cla_cid, $cla_nid, $cla_site; $email = __post('email'); $password = md5(__post('password')); $sql = "select * from ntk_users where email='" . $email . "' and password='******'"; $result = $db->query($sql, true, "Query failed"); $user_info = array(); $is_login = false; if ($aR = $db->fetchByAssoc($result)) { if ($aR['email'] == $email && $password == $aR['password']) { $is_login = true; $user_info = $aR; } } if ($is_login) { $_SESSION[_PLATFORM_]['is_login'] = true; $_SESSION[_PLATFORM_]['USER_INFO'] = $user_info; $url_redirec = $_SESSION[_PLATFORM_]['pre_url']; echo "<script>window.location.href='" . $url_redirec . "'</script>"; } }
<?php session_start(); /* if (is_admin() && $cla_module=='' && $cla_action==''){ $cla_module='Config'; $cla_action='Hospital'; } */ if ($cla_module == '') { $cla_module = 'TSDefault'; } if ($cla_action == '') { $cla_action = 'index'; } $no_body = __post('no_body') == '' ? __get('no_body') : __post('no_body'); $cla_module == '' ? 'TSDefault' : $cla_module; define('_MODULE_', $cla_module); define('_ACTION_', $cla_action); require_once 'XTemplate/xtpl.php'; require_once admin_dir . "classes/TSDefault/TSDefault.class.php"; try { if (is_file(admin_dir . "classes/" . $cla_module . "/" . $cla_module . ".class.php")) { require_once admin_dir . "classes/" . $cla_module . "/" . $cla_module . ".class.php"; } if (class_exists($cla_module)) { $cla = new $cla_module(); $cla->define(); if ($cla_module != 'TSDefault' && $cla_module != 'Ajax' && $cla_module != 'Error' && !$cla->acl_access()) { ts_permission(1, $ts_config['site_url']); }
function setList($CaptchaText, $filter, $conpany_list) { global $ts_config; $result = NULL; $PageSize = 10; $this->PageIndex = isset($_POST["page"]) ? $_POST["page"] : 1; if ($_POST['ddlPageSize'] != '') { $PageSize = $_POST['ddlPageSize']; } $this->PageSize = $PageSize; $_FlgExport = false; $mode_inpvl = __post('mode_inpvl'); if ($mode_inpvl == 'EXPORT') { $PageSize = 0; $_FlgExport = true; } $_Table = 'ws_rf_absent_list'; $_KeyField = 'absent_list_id'; // ===== order =============/ $_SortOrderBy = $_POST["_SortOrderBy"]; $_OrderDirection = $_POST["_OrderDirection"]; if (trim($_SortOrderBy) == '' || $_FlgExport) { $_OrderBy = 'id'; $_OrderDirection = 'desc'; } else { $_OrderBy = $this->arrSortHeader[$_SortOrderBy]; } // ===== order =============/ $_Where = " and 1=1 and t1.status <> -13 " . $filter; try { $_dblist = ''; $i = 0; $start = ($this->PageIndex - 1) * $PageSize; if ($mode_inpvl == 'EXPORT') { $sSQL = "select t1.*,t2.category_name_vi as cname, t2.category_name_en as cname_en\n\t\t\t\t\tfrom ntk_forum_posts t1 \n\t\t\t\t\tleft join ntk_forum_categories t2 on t1.cid = t2.category_id\n\t\t\t\t\twhere 1=1 " . $_Where . " order by " . $_OrderBy . " " . $_OrderDirection; } else { $sSQLTotal = "select count(t1.id) as TotalRecord \n\t\t\t\t\tfrom ntk_forum_posts t1\n\t\t\t\t\tleft join ntk_forum_categories t2 on t1.cid = t2.category_id\n\t\t\t\t\twhere 1=1 " . $_Where; $sSQL = "select t1.*,t2.category_name_vi as cname, t2.category_name_en as cname_en\n\t\t\t\t\tfrom ntk_forum_posts t1 \n\t\t\t\t\tleft join ntk_forum_categories t2 on t1.cid = t2.category_id\n\t\t\t\t\twhere 1=1 " . $_Where . " order by " . $_OrderBy . " " . $_OrderDirection . " limit " . $start . "," . $PageSize; //echo $sSQL; $resultTotal = $this->db->query($sSQLTotal, true, "Query failed"); $aRTotal = $this->db->fetchByAssoc($resultTotal); $this->TotalRecord = $aRTotal['TotalRecord']; $this->TotalPage = intval($this->TotalRecord / $PageSize + ($this->TotalRecord % $PageSize > 0 ? 1 : 0)); } $result = $this->db->query($sSQL, true, "Query failed"); $tooltip = ''; $arr_wrap = array('content_vi', 'content_en', 'short_vi', 'short_en', 'title_vi', 'title_en'); while ($aR = $this->db->fetchByAssoc($result)) { $_RowNum = $aR['RowNum']; $_TotalRecord = $aR['TotalRecord']; $STT = $i + ($this->PageIndex - 1) * $PageSize + 1; $id = $aR['id']; $_dblist .= '<tr>'; if ($mode_inpvl == 'EXPORT') { $_dblist .= '<td style="text-align:center" width=50>' . $STT . '</td>'; } else { $inp_del = '<div title="" class="status_box ' . $status_class_name . '">'; $tokenDelete = $this->md5sum($this->prefix['delete'] . $id); $inp_del .= ' <input type=checkbox value="' . $id . '|' . $tokenDelete . '" name="chk[]" id="chk_' . $STT . '">'; $tokenEdit = $this->md5sum('edit' . $id); $inp_del .= ' <a href="?module=Config&action=PostAdd&Id=' . $id . '&token=' . $tokenEdit . '"><img src="../images/edit2.png" width=16 height=16 style="cursor:pointer;margin-right:5px" ></a>'; //$inp_del.= ' <img src="../images/edit2.png" width=16 height=16 style="cursor:pointer;margin-right:5px" onclick="dg_add(\'Config\',\'PostAdd\','.$id.',\''.$tokenEdit.'\',\'Cập nhật thông tin\',800,600)">'; $inp_del .= '<img src="../images/delete.png" width=16 height=16 style="cursor:pointer;" onclick="dg_del(' . $id . ',\'' . $tokenDelete . '\',' . $STT . ',\'' . $CaptchaText . '\')">'; $inp_del .= '<a href="' . $ts_config['site_url_admin'] . '?module=Config&action=PostComment&post_id=' . $id . '"><img src="../images/comment.png" width=16 height=16 style="cursor:pointer;"></a>'; $inp_del .= '</div>'; $_dblist .= '<td nowrap style="text-align:left;width:60px">' . $inp_del . '</td>'; } if ($mode_inpvl != 'EXPORT') { $arr_status = array(1 => '<div class="icon_status_success"></div>', 0 => '<div class="icon_status_fail"></div>'); } else { $arr_status = array(1 => 'Active', 0 => 'InActive'); } foreach ($this->arrHeader as $field => $name) { if ($field == 'status' || $field == 'show_index') { $aR[$field] = $arr_status[(int) $aR[$field]]; } if ($field != 'STT') { if (in_array($field, $arr_wrap)) { $len = strlen($aR[$field]); if ($len > 50) { $data = substr($aR[$field], 0, 50) . ' ....'; } else { $data = $aR[$field]; } $_dblist .= '<td title = "' . $aR[$field] . '" style="text-align:left"><pre>' . $data . '</pre></td>'; } else { $_dblist .= '<td style="text-align:left">' . $aR[$field] . '</td>'; } } } $_dblist .= '</tr>'; $i++; } if ($i == 0) { if ($this->TotalRecord == 0) { $_dblist .= '<tr><td colspan=100>Không tìm thấy thông tin</td></tr>'; } } else { } } catch (PDOException $ex) { } $list[0] = $_dblist; return $list; }
function execute() { global $ts_config; $_Title = 'Quản lý Bài viết'; $_msg = null; $captcha = new SimpleCaptcha(); $formmode = $_POST["formmode"]; $mode_inpvl = __post('mode_inpvl'); $captchatxt = __post('captcha'); $captchaForm = __post('captchaForm'); $idchk = $_POST["chk"]; $flagCaptcha = $captcha->CaptchaValidate($captchatxt); $flagCaptchaForm = $captcha->CaptchaValidate($captchaForm); $Id = __post2("Id"); $token = __post2("token"); if ($Id > 0) { if ($token != $this->md5sum('edit' . $Id)) { die('Do not have permission to access page!'); } } $list_form = new XTemplate('Config/NewsAdd.html'); if ($mode_inpvl == 'ADD') { $menu_id = __post("menu_id"); $title_vi = __post("title_vi"); $title_en = __post("title_en"); $short_vi = __post("short_vi"); $short_en = __post("short_en"); $content_vi = __post("content_vi"); $content_en = __post("content_en"); $keyword_vi = __post("keyword_vi"); $keyword_en = __post("keyword_en"); $status = (int) __post("status"); $result_id = $this->form_add($Id, $menu_id, $title_vi, $title_en, $short_vi, $short_en, $content_vi, $content_en, $keyword_vi, $keyword_en, $status); if ((int) $Id <= 0) { $Id = $result_id; } $result = UpLoadMultiFile($ts_config['upload_dir'], 'filenew', false, '', $max_size = 9048576); $file_type_id = 7; foreach ($result as $k => $va) { if ($va['result'] == 1) { $sSQL = "insert into ntk_new_files(new_id,file_name,file_path,file_type_id,require_login)\n\t\t\t\t\t\tvalues(" . $Id . ",'" . $va['name'] . "','" . $va['file_name'] . "'," . $file_type_id . ",1)\n\t\t\t\t\t"; $re = $this->db->query($sSQL, true, "Query failed"); } } if ($result_id > 0) { $_msg['result'] = 1; } else { $_msg['result'] = -20; } } if ((int) $Id > 0) { $data = $this->getDetail($Id); foreach ($data as $key => $value) { ${$key} = $value; } $sSQL = "select * from ntk_new_files where new_id = " . (int) $Id; $result = $this->db->query($sSQL, true, "Query failed"); while ($aR = $this->db->fetchByAssoc($result)) { $list_form->assign('file', $aR); $list_form->parse('main.file'); } } $left_menu = $this->rmenu(); $list_form->assign('slide_bar', $this->slide_bar($left_menu)); $list_form->assign('tabs', $this->set_tabs()); $list_form->assign('dialog_title', 'thành viên'); $CaptchaText = $captcha->CreateText(); $arr_info_menu_id = $this->getListNewsCategories(); $Attr_menu_id = array('rel' => '{Require:\'R\',Alert:\'Vui lòng chọn danh mục \'}', 'style' => 'width:400px;'); $txt_menu_id = addSelectList2('menu_id', $arr_info_menu_id, NULL, $Attr_menu_id, $list_form, $cid); $arr_info_status = array(1 => 'Active', 0 => 'InActive'); $Attr_status = array('rel' => '{Require:\'R\',Alert:\'Vui lòng chọn trạng thái \'}', 'style' => ''); $txt_status = addSelectList2('status', $arr_info_status, NULL, $Attr_status, $list_form, $status); $Attr_psttitle_vi = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập tiêu đề tiếng việt \'}', 'style' => 'width:400px;'); $txt_psttitle_vi = addInput('text', 'title_vi', $title_vi, $Attr_psttitle_vi, $list_form); $Attr_psttitle_en = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập tiêu đề tiếng anh \'}', 'style' => 'width:400px;'); $txt_psttitle_en = addInput('text', 'title_en', $title_en, $Attr_psttitle_en, $list_form); $class_input = 'ckeditor'; $Attr_short_vi = array('class' => $class_input, 'rel' => '{Require:\'R\',Alert:\'Vui lòng nhập mô tả ngắn tiếng việt \'}', 'style' => 'width:400px;'); $txt_short_vi = addTextarea('short_vi', 3, 30, $short_vi, $Attr_short_vi, $list_form); $Attr_short_en = array('class' => $class_input, 'rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập role_name \'}', 'style' => 'width:400px;'); $txt_short_en = addTextarea('short_en', 3, 30, $short_en, $Attr_short_en, $list_form); $Attr_content_vi = array('class' => $class_input, 'rel' => '{Require:\'R\',Alert:\'Vui lòng nhập Nội dung tiếng việt \'}', 'style' => 'width:400px;'); $txt_content_vi = addTextarea('content_vi', 3, 30, $content_vi, $Attr_content_vi, $list_form); $Attr_content_en = array('class' => $class_input, 'rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập Nội dung tiếng anh \'}', 'style' => 'width:400px;'); $txt_content_en = addTextarea('content_en', 3, 30, $content_en, $Attr_content_en, $list_form); $Attr_pstkeyword_vi = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập từ khóa tiếng việt \'}', 'style' => 'width:400px;'); $txt_pstkeyword_vi = addInput('text', 'keyword_vi', $keyword_vi, $Attr_pstkeyword_vi, $list_form); $Attr_pstkeyword_en = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập từ khóa tiếng anh\'}', 'style' => 'width:400px;'); $txt_pstkeyword_en = addInput('text', 'keyword_en', $keyword_en, $Attr_pstkeyword_en, $list_form); if ($this->acl_per(2)) { //$arr_attr_btnadd = array('style'=>'color:blue;','onclick'=>'sbm_form(2,\''.$CaptchaText.'\')'); $arr_attr_btnadd = array('style' => 'color:blue;', 'onclick' => 'add()'); $inp_btnadd = addInput2('button', 'btnadd', $btnadd, $arr_attr_btnadd, $list_form, 'LƯU'); } $list_form->assign('Id', $Id); $list_form->assign('token', $token); //$list_form->parse('main'); // $html = $list_form->out_return('main'); $list_form->assign('title', $_Title); $list_form->assign('_error_', $error); $list_form->assign('gridview', $gridview); $list_form->parse('main'); $this->html = $list_form->out_return('main'); echo $this->html; }
function page_post() { global $db, $fullsite, $cla_cid, $cla_nid, $cla_site, $ts_config; $_msg = null; if (isset($_POST['title']) && __post('title') != '') { $result = array('result' => -1, 'data' => ''); if (!is_login()) { $_msg['msg'] = get_lang('forum_post_error_1'); $_msg['result'] = -1; } $user_info = get_user_info_login(); $user_email = $user_info['email']; $title = __post('title'); $category_id = __post('category_id'); $content = __post('content'); $status = 1; if ($title != '' && $category_id > 0 && $content != '') { $sSQL = " insert into ntk_forum_posts (cid,title_vi,content_vi,status,create_date,create_by)\n\t\t\t\t\t\tvalues(" . (int) $category_id . ",N'" . $title . "',N'" . $content . "'," . $status . ",NOW(),'" . $user_email . "')\n\t\t\t\t\t\t"; $result = $db->query($sSQL, true, "Query failed"); if ($result != NULL) { $sSQL = "\tselect * from ntk_forum_posts where `status` = 1 order by id desc limit 0,1 "; $result = $db->query($sSQL, true, "Query failed"); if ($aR = $db->fetchByAssoc($result)) { $_msg['result'] = 1; $_msg['msg'] = get_lang('forum_post_success'); $_msg['post_id'] = $aR['id']; $post_id = $aR['id']; $title_link = fnStrConvert($title); $title_link = str_replace(" ", '-', $title_link); $link_detail = forum_path . "/" . $category_id . "/" . $post_id . "/" . $title_link . ".html"; } } else { $_msg['result'] = -3; $_msg['msg'] = get_lang('forum_post_error_3'); } } else { $_msg['result'] = -2; $_msg['msg'] = get_lang('forum_post_error_2'); } } if ($_msg != null) { if ($_msg['result'] == 1) { $post_success = true; $_msg['msg'] == '<span style="color:#0000FF; font-size:14px;">' . $_msg['msg'] . '</span>'; } else { $_msg['msg'] == '<span style="color:#FF0000; font-size:14px;">' . $_msg['msg'] . '</span>'; } } $category_list = get_list_categories(); include 'themes/NTK/forum_post.php'; }
function execute() { global $ts_config; $_Title = 'Forum - Quản lý Bài đăng'; $_msg = null; $captcha = new SimpleCaptcha(); $formmode = $_POST["formmode"]; $mode_inpvl = __post('mode_inpvl'); $captchatxt = __post('captcha'); $captchaForm = __post('captchaForm'); $idchk = $_POST["chk"]; $flagCaptcha = $captcha->CaptchaValidate($captchatxt); $flagCaptchaForm = $captcha->CaptchaValidate($captchaForm); $Id = __post("Id"); if ($Id > 0) { if ($token != $this->md5sum('edit' . $Id)) { die('Do not have permission to access page!'); } } if ($mode_inpvl == 'ADD') { $menu_id = __post("menu_id"); $title_vi = __post("title_vi"); $title_en = __post("title_en"); $short_vi = __post("short_vi"); $short_en = __post("short_en"); $content_vi = __post("content_vi"); $content_en = __post("content_en"); $keyword_vi = __post("keyword_vi"); $keyword_en = __post("keyword_en"); $status = (int) __post("status"); $show_index = (int) __post("show_index"); $result_id = $this->form_add($id, $menu_id, $title_vi, $title_en, $short_vi, $short_en, $content_vi, $content_en, $keyword_vi, $keyword_en, $status, $show_index); if ((int) $id <= 0) { $id = $result_id; } if ($result_id > 0) { $_msg['result'] = 1; } else { $_msg['result'] = -20; } } $list_form = new XTemplate('Config/PostAdd.html'); $left_menu = $this->rmenu(); $list_form->assign('slide_bar', $this->slide_bar($left_menu)); $list_form->assign('tabs', $this->set_tabs()); $list_form->assign('dialog_title', 'thành viên'); $CaptchaText = $captcha->CreateText(); if ((int) $Id > 0) { $token = __post("token"); $data = $this->getDetail($Id); foreach ($data as $key => $value) { ${$key} = $value; } /* $sSQL = "select * from ntk_forum_posts where id = ".(int)$Id; $result = $this->db->query($sSQL, true, "Query failed"); while ($aR = $this->db->fetchByAssoc($result)){ $list_form->assign('file',$aR); $list_form->parse('main.file'); }*/ } $class_input = 'ckeditor'; $arr_info_menu_id = $this->getListPostCategories(); $Attr_menu_id = array('rel' => '{Require:\'R\',Alert:\'Vui lòng chọn danh mục \'}', 'style' => 'width:400px;'); $txt_menu_id = addSelectList2('menu_id', $arr_info_menu_id, NULL, $Attr_menu_id, $list_form, $menu_id); $arr_info_status = array(1 => 'Active', 0 => 'InActive'); $Attr_status = array('rel' => '{Require:\'R\',Alert:\'Vui lòng chọn trạng thái \'}', 'style' => ''); $txt_status = addSelectList2('status', $arr_info_status, NULL, $Attr_status, $list_form, $status); $Attr_psttitle_vi = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập tên bệnh viện \'}', 'style' => 'width:400px;'); $txt_psttitle_vi = addInput('text', 'title_vi', $title_vi, $Attr_psttitle_vi, $list_form); $Attr_psttitle_en = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập tên bệnh viện \'}', 'style' => 'width:400px;'); $txt_psttitle_en = addInput('text', 'title_en', $title_en, $Attr_psttitle_en, $list_form); $Attr_short_vi = array('class' => $class_input, 'rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập role_name \'}', 'style' => 'width:400px;'); $txt_short_vi = addTextarea('short_vi', 3, 30, $short_vi, $Attr_short_vi, $list_form); $Attr_short_en = array('class' => $class_input, 'rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập role_name \'}', 'style' => 'width:400px;'); $txt_short_en = addTextarea('short_en', 3, 30, $short_en, $Attr_short_en, $list_form); $Attr_content_vi = array('class' => $class_input, 'rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập role_name \'}', 'style' => 'width:400px;'); $txt_content_vi = addTextarea('content_vi', 3, 30, $content_vi, $Attr_content_vi, $list_form); $Attr_content_en = array('class' => $class_input, 'rel1' => '{Require:\'R\',Alert:\'Vui lòng nhập role_name \'}', 'style' => 'width:400px;'); $txt_content_en = addTextarea('content_en', 3, 30, $content_en, $Attr_content_en, $list_form); $Attr_pstkeyword_vi = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập tên bệnh viện \'}', 'style' => 'width:400px;'); $txt_pstkeyword_vi = addInput('text', 'keyword_vi', $keyword_vi, $Attr_pstkeyword_vi, $list_form); $Attr_pstkeyword_en = array('rel' => '{Require:\'R\',Alert:\'Vui lòng nhập tên bệnh viện \'}', 'style' => 'width:400px;'); $txt_pstkeyword_en = addInput('text', 'keyword_en', $keyword_en, $Attr_pstkeyword_en, $list_form); $arr_info_show_index = array(1 => 'Hiển thị trang chủ', 0 => 'Không hiển thị trang chủ'); $Attr_show_index = array('rel1' => '{Require:\'R\',Alert:\'Vui lòng chọn trạng thái \'}', 'style' => ''); $txt_show_index = addSelectList2('show_index', $arr_info_show_index, NULL, $Attr_show_index, $list_form, $show_index); if ($this->acl_per(2)) { $arr_attr_btnadd = array('style' => 'color:blue;', 'onclick' => 'add()'); $inp_btnadd = addInput2('button', 'btnadd', $btnadd, $arr_attr_btnadd, $list_form, 'LƯU'); } setMessage($list_form, $_msg); $list_form->assign('title', $_Title); $list_form->assign('_error_', $error); $list_form->assign('gridview', $gridview); $list_form->assign('Id', $Id); $list_form->assign('token', $token); $list_form->parse('main'); $html = $list_form->out_return('main'); echo $html; }