require_once dirname(__FILE__) . '/taxonomy/taxonomy_model.php'; if ($_SERVER['HTTP_HOST'] != parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST)) { hm_exit('403 - Truy cập bị từ chối'); } $key = hm_get('key'); $id = hm_get('id'); $action = hm_get('action'); switch ($action) { case 'data': $status = hm_get('status', 'public'); $perpage = hm_get('perpage', '30'); echo taxonomy_show_data($key, $status, $perpage); break; case 'add': /** Thực hiện thêm taxonomy */ echo taxonomy_ajax_add($key); break; case 'edit': /** Thực hiện sửa taxonomy */ echo taxonomy_ajax_edit($id); break; case 'draft': /** Thực hiện xóa taxonomy */ taxonomy_update_val(array('id' => hm_post('id'), 'value' => array('status' => MySQL::SQLValue('draft')))); break; case 'delete_permanently': /** Thực hiện xóa vĩnh viễn taxonomy */ taxonomy_delete_permanently(hm_post('id')); break; case 'public': /** Thực hiện khôi phục taxonomy */
function taxonomy_ajax_edit($id) { global $hmcontent; $hmdb = new MySQL(true, DB_NAME, DB_HOST, DB_USER, DB_PASSWORD, DB_CHARSET); hook_action('taxonomy_ajax_edit'); $tableName = DB_PREFIX . "taxonomy"; $whereArray = array('id' => MySQL::SQLValue($id)); $hmdb->SelectRows($tableName, $whereArray); if ($hmdb->HasRecords()) { $row = $hmdb->Row(); $content_key = $row->key; } return taxonomy_ajax_add($content_key, $id); }