Example #1
0
function getValue($value_name, $data_type = "int", $method = "GET", $default_value = 0, $advance = 0)
{
    $value = $default_value;
    switch ($method) {
        case "GET":
            if (isset($_GET[$value_name])) {
                $value = $_GET[$value_name];
            }
            break;
        case "POST":
            if (isset($_POST[$value_name])) {
                $value = $_POST[$value_name];
            }
            break;
        case "COOKIE":
            if (isset($_COOKIE[$value_name])) {
                $value = $_COOKIE[$value_name];
            }
            break;
        case "SESSION":
            if (isset($_SESSION[$value_name])) {
                $value = $_SESSION[$value_name];
            }
            break;
        default:
            if (isset($_GET[$value_name])) {
                $value = $_GET[$value_name];
            }
            break;
    }
    $valueArray = array("int" => intval($value), "str" => trim(strval($value)), "flo" => floatval($value), "dbl" => doubleval($value), "arr" => $value);
    foreach ($valueArray as $key => $returnValue) {
        if ($data_type == $key) {
            if ($advance != 0) {
                switch ($advance) {
                    case 1:
                        $returnValue = replaceMQ($returnValue);
                        break;
                    case 2:
                        $returnValue = htmlspecialbo($returnValue);
                        break;
                }
            }
            //Do số quá lớn nên phải kiểm tra trước khi trả về giá trị
            if (strval($returnValue) == "INF" && $data_type != "str") {
                return 0;
            }
            return $returnValue;
            break;
        }
    }
    return intval($value);
}
function prepare_hoidap_record(&$row_news, $type_image = 'mobile')
{
    if (isset($row_news['que_title']) && $row_news['que_title']) {
        $row_news['que_title'] = htmlspecialbo($row_news['que_title']);
    }
    if (isset($row_news['que_image']) && $row_news['que_image']) {
        $row_news['que_image_low'] = get_picture_path($row_news['que_image'], $type_image . '_low');
        $row_news['que_image'] = get_picture_path($row_news['que_image'], $type_image);
    }
    if (isset($row_news['que_question_content']) && $row_news['que_question_content']) {
        $row_news['full_question_content'] = $row_news['que_question_content'];
        $row_news['que_question_content'] = removeHTML($row_news['que_question_content']);
        $row_news['que_question_content'] = cut_string($row_news['que_question_content'], 50);
    }
    if (isset($row_news['que_date']) && $row_news['que_date']) {
        $row_news['post_time'] = date('d/m/Y | H:i', $row_news['que_date']);
    }
    $row_news['link_detail'] = generate_hoidap_detail($row_news);
    return $row_news;
}
Example #3
0
function redirect($url){
	$url	= htmlspecialbo($url);
	echo '<script type="text/javascript">window.location.href = "' . $url . '";</script>';
	exit();
}
Example #4
0
    $row['new_picture'] = get_picture_path($row['new_picture'], 'medium');
    $list_news_tsk['array_news'][] = $row;
}
if (!$check_i) {
    //tin hot mục sức khỏe không có tin mới trong khoảng thời gian MIN_TIME_NEWS_HOT hoặc chưa thỏa mãn MIN_NEWS_VIEW
    $db_news_tsk_hot = new db_query('SELECT new_id,
                                            new_title,
                                            new_picture
                                     FROM   news
                                     WHERE  new_active = 1
                                        AND new_cat_id = ' . $cat_tsk['cat_id'] . '
                                     ORDER BY new_view DESC
                                     LIMIT 3');
    while ($row = mysqli_fetch_assoc($db_news_tsk_hot->result)) {
        $check_i++;
        $row['new_title'] = htmlspecialbo($row['new_title']);
        $row['cat_name'] = $cat_tsk['cat_name'];
        $row['link_detail'] = generate_news_detail_url($row);
        $row['new_picture'] = get_picture_path($row['new_picture'], 'medium');
        $list_news_tsk['array_news'][] = $row;
    }
}
shuffle($list_news_category);
array_pop($list_news_category);
$rainTpl->assign('list_news_category', $list_news_category);
$rainTpl->assign('list_news_tsk', $list_news_tsk);
//list câu hỏi và bệnh khối hỏi đáp bên phải
$list_qaa_sidebar = get_qaa_listing_sidebar();
$rainTpl->assign('list_qaa_sidebar', $list_qaa_sidebar);
//khối sơ đồ cơ thể
$anatomy_sex = get_cookie_anatomy_sex();
Example #5
0
 public function cleanup()
 {
     $this->content = htmlspecialbo($this->content);
     return $this;
 }
Example #6
0
function prepare_pharma_record(&$ss)
{
    if (isset($ss['pha_title']) && $ss['pha_title']) {
        $ss['pha_title'] = htmlspecialbo($ss['pha_title']);
    }
    if (isset($ss['pha_image']) && $ss['pha_image']) {
        $ss['pha_image'] = get_picture_path($ss['pha_image']);
    }
    $ss['link_detail'] = generate_tuthuoc_detail($ss);
    return $ss;
}
Example #7
0
                          WHERE que_cat_id = ' . $detail_data['cat_id'] . '
                          AND que_status = 1 AND que_type = 0
                          AND que_id <> ' . $detail_data['que_id'] . '
                          ORDER BY que_date DESC
                          LIMIT 0,4');
while ($row = mysqli_fetch_assoc($db_query->result)) {
    $row['cat_name'] = $detail_data['cat_name'];
    $row['que_title'] = htmlspecialbo($row['que_title']);
    $row['que_date'] = date('H:i - d/m/Y', $row['que_date']);
    $row['link_detail'] = generate_hoidap_detail($row);
    $list_question_cat[] = $row;
}
$rainTpl->assign('list_question_cat', $list_question_cat);
//câu hỏi liên quan
$array_question_relate = array();
if ($detail_data['que_relate']) {
    //nếu đã có trong relate thì lấy ra
    $db_relate = new db_query('SELECT que_id, que_title, cat_name, que_date
                                FROM questions
                                LEFT JOIN categories ON cat_id = que_cat_id
                                WHERE que_id IN(' . $detail_data['que_relate'] . ')');
    while ($row = mysqli_fetch_assoc($db_relate->result)) {
        $row['que_title'] = htmlspecialbo($row['que_title']);
        $row['que_date'] = date('d/m', $row['que_date']);
        $row['link_detail'] = generate_hoidap_detail($row);
        $array_question_relate[] = $row;
    }
} else {
    $array_question_relate = get_question_relate($detail_data['que_tags'], 5, $detail_data['que_id'], $detail_data['cat_id']);
}
$rainTpl->assign('array_question_relate', $array_question_relate);
Example #8
0
$count_i = 0;
while ($row = mysqli_fetch_assoc($db_list_news->result)) {
    //xử lý dữ liệu
    $row['new_title'] = htmlspecialbo($row['new_title']);
    $row['new_picture'] = get_picture_path($row['new_picture'], 'medium2');
    $row['new_teaser'] = htmlspecialbo($row['new_teaser']);
    $row['new_date'] = getDateTime(1, 1, 1, 1, '', $row['new_date']);
    $row['link_detail'] = generate_news_detail_url($row);
    if (!$row['new_teaser']) {
        //không có teaser - query từ detail tin
        $db_detail = new db_query('SELECT * FROM news_detail WHERE new_id = ' . $row['new_id']);
        $row['new_teaser'] = mysqli_fetch_assoc($db_detail->result);
        unset($db_detail);
        $row['new_teaser'] = removeHTML($row['new_teaser']);
        $row['new_teaser'] = cut_string($row['new_teaser'], 130);
        $row['new_teaser'] = htmlspecialbo($row['new_teaser']);
    }
    $count_i++;
    if ($count_i <= 4) {
        //add vào list trên
        $top_list_left[] = $row;
    } else {
        $category_list_news[] = $row;
    }
}
$rainTpl->assign('category_list_news', $category_list_news);
$rainTpl->assign('top_list_left', $top_list_left);
//truyền thêm tham số vào pjax
$pjax_params = array('query_unique' => $string_query_unique);
$rainTpl->assign('pjax_params_base64', pjax_param_create($pjax_params));
//list câu hỏi và bệnh khối hỏi đáp bên phải
Example #9
0
$check_link_redirect = $_SERVER['REQUEST_URI'] == generate_news_detail_url($detail_data);
if (!$check_link_redirect) {
    move301(generate_news_detail_url($detail_data));
}
//assign quảng cáo
$rainTpl->assign('adv_top', $adv_top);
$rainTpl->assign('adv_right', $adv_right);
//quảng cáo banner
$rainTpl->assign('adv_banner_list', $adv_banner_list);
$fb_see_also = '';
if ($array_link_see_also) {
    foreach ($array_link_see_also as $see_also_url) {
        $fb_see_also .= '<meta property="og:see_also" content="' . $see_also_url . '" />';
    }
}
$facebook_og = '
<meta property="og:title" content="' . htmlspecialbo($detail_data['new_title']) . '"/>
<meta property="fb:app_id" content="1561038610796934" />
<meta property="fb:profile_id" content="1508569846068761" />
' . $fb_see_also . '
<meta property="og:type" content="article" />
<meta property="og:determiner" content="auto" />
<meta property="article:section" content="' . htmlspecialbo($detail_data['cat_name']) . '" />
<meta property="article:publisher" content="https://www.facebook.com/suckhoeankhang" />
<meta property="article:published_time" content="' . $datetime_facebook . '" />
<meta property="og:url" content="http://khang.vn' . generate_news_detail_url($detail_data) . '" />
<meta property="og:image" content="' . $detail_data['new_picture'] . '"/>
<meta property="og:description" content="' . htmlspecialbo($detail_data['new_teaser']) . '">
<meta property="og:updated_time" content="' . time() . '">';
$rainTpl->assign('facebook_og', $facebook_og);
$rainTpl->draw('news_detail');
Example #10
0
if (isset($detail_data['que_title']) && $detail_data['que_title']) {
    $page_title = t($detail_data['que_title'] . ' | Chuyên mục hỏi đáp');
} else {
    $page_title = t('Trang hỏi đáp, tư vấn khám chữa bệnh miễn phí');
}
$rainTpl->assign('page_title', $page_title);
$og_url = DOMAIN_URL . generate_hoidap_detail($detail_data);
$rainTpl->assign('og_url', $og_url);
//so sánh link với link được request
$check_link_redirect = $_SERVER['REQUEST_URI'] == generate_hoidap_detail($detail_data);
if (!$check_link_redirect) {
    move301(generate_hoidap_detail($detail_data));
}
$meta_description = cut_string($detail_data['que_question_content'], 200);
$rainTpl->assign('meta_description', $meta_description);
$meta_keyword = '';
$rainTpl->assign('meta_keyword', $meta_keyword);
$facebook_og = '<meta property="og:title" content="' . htmlspecialbo($detail_data['que_title']) . '"/>
<meta property="fb:app_id" content="1561038610796934" />
<meta property="fb:profile_id" content="1508569846068761" />
<meta property="og:type" content="article" />
<meta property="og:determiner" content="auto" />
<meta property="article:section" content="' . htmlspecialbo($detail_data['cat_name']) . '" />
<meta property="article:publisher" content="https://www.facebook.com/suckhoeankhang" />
<meta property="article:published_time" content="' . $datetime_facebook . '" />
<meta property="og:url" content="' . $og_url . '" />
<meta property="og:image" content="' . $detail_data['que_image'] . '"/>
<meta property="og:description" content="' . htmlspecialbo(removeHTML($meta_description)) . '">
<meta property="og:updated_time" content="' . time() . '">';
$rainTpl->assign('facebook_og', $facebook_og);
$rainTpl->draw('detail');