Exemple #1
0
        define('NV_COMM_ID', $data_content['id']);
        //ID bài viết hoặc
        define('NV_COMM_AREA', $module_info['funcs'][$op]['func_id']);
        //để đáp ứng comment ở bất cứ đâu không cứ là bài viết
        //check allow comemnt
        $allowed = $module_config[$module_name]['allowed_comm'];
        //tuy vào module để lấy cấu hình. Nếu là module news thì có cấu hình theo bài viết
        if ($allowed == '-1') {
            $allowed = $data_content['allowed_comm'];
        }
        define('NV_PER_PAGE_COMMENT', 5);
        //Số bản ghi hiển thị bình luận
        require_once NV_ROOTDIR . '/modules/comment/comment.php';
        $area = defined('NV_COMM_AREA') ? NV_COMM_AREA : 0;
        $checkss = md5($module_name . '-' . $area . '-' . NV_COMM_ID . '-' . $allowed . '-' . NV_CACHE_PREFIX);
        $content_comment = nv_comment_module($module_name, $checkss, $area, NV_COMM_ID, $allowed, 1);
    } else {
        $content_comment = '';
    }
    $contents = detail_product($data_content, $data_unit, $data_others, $array_other_view, $content_comment, $compare_id, $popup, $idtemplate, $array_keyword);
} else {
    $nv_redirect = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name;
    redict_link($lang_module['detail_no_permission'], $lang_module['redirect_to_back_shops'], $nv_redirect);
}
if ($popup) {
    echo $contents;
} else {
    include NV_ROOTDIR . '/includes/header.php';
    echo nv_site_theme($contents);
    include NV_ROOTDIR . '/includes/footer.php';
}
    if ($payment_data != $payment_data_old) {
        $transaction_id = $db->insert_id("INSERT INTO " . $db_config['prefix'] . "_" . $module_data . "_transaction (transaction_id, transaction_time, transaction_status, order_id, userid, payment, payment_id, payment_time, payment_amount, payment_data) VALUES (NULL, UNIX_TIMESTAMP(), '" . $nv_transaction_status . "', '" . $order_id . "', '0', '" . $payment . "', '" . $payment_id . "', '" . $payment_time . "', '" . $payment_amount . "', '" . $payment_data . "')");
        if ($transaction_id > 0) {
            $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $nv_transaction_status . " , transaction_id = " . $transaction_id . " , transaction_count = transaction_count+1 WHERE order_id=" . $order_id);
        } else {
            $error_update = true;
        }
        $nv_transaction_status = intval($transaction_i['nv_transaction_status']);
        if ($transaction_id > 0) {
            $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $nv_transaction_status . " , transaction_id = " . $transaction_id . " , transaction_count = transaction_count+1 WHERE order_id=" . $order_id);
        } else {
            $error_update = true;
        }
    }
    if (!$error_update) {
        // Cap nhat diem tich luy
        $data_content = array();
        $result = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_orders WHERE order_id=' . $order_id);
        $data_content = $result->fetch();
        if (!empty($data_content)) {
            UpdatePoint($data_content);
        }
        $nv_redirect = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=history";
        $contents = redict_link($lang_module['payment_complete'], $lang_module['back_history'], $nv_redirect);
    }
}
if ($error_text != "") {
    $contents = $error_text;
} else {
    $contents = $lang_module['payment_erorr'];
}
            $data_insert['roomid'] = $data['roomid'];
            $data_insert['fieldid'] = $data['fieldid'];
            $data_insert['down'] = $data['down'];
            $data_insert['view'] = $data['view'];
            $data_insert['userid'] = $data['userid'];
            $data_insert['type'] = $data['type'];
            $data_insert['sign'] = $data['sign'];
            $data_insert['signtime'] = $data['signtime'];
            $data_insert['organid'] = $data['organid'];
            $newid = $db->insert_id($sql, 'id', $data_insert);
            if ($newid > 0) {
                nv_del_moduleCache($module_name);
                nv_fix_cat_row($data['catid']);
                nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['addcontent'], $data['title'], $user_info['userid']);
                $nv_redirect = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name;
                redict_link($lang_module['upload_ok'], $lang_module['upload_view'], $nv_redirect);
            } else {
                $error = $lang_module['errorsave'];
            }
            $db->sqlreset();
        }
    }
}
if ($data['signtime'] == 0) {
    $data['signtime'] = "";
} elseif ($data['signtime'] > 0) {
    $data['signtime'] = date("d/m/Y", $data['signtime']);
}
$contents = upload_content($data, $error);
include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
            $stmt = $db->prepare($db->sql());
            $stmt->bindParam(':payment_id', $tran_ID, PDO::PARAM_STR);
            $stmt->execute();
            $payment_data_old = $stmt->fetchColumn();
            if ($payment_data != $payment_data_old) {
                $nv_transaction_status = intval($Status);
                $payment_amount = intval($amt);
                $payment_time = $PaymentDate;
                $transaction_id = $db->insert_id("INSERT INTO " . $db_config['prefix'] . "_" . $module_data . "_transaction (transaction_id, transaction_time, transaction_status, order_id, userid, payment, payment_id, payment_time, payment_amount, payment_data) VALUES (NULL, " . NV_CURRENTTIME . ", '" . $nv_transaction_status . "', '" . $PaymentDetail['order_id'] . "', '0', '" . $payment . "', '" . $tran_ID . "', '" . $payment_time . "', '" . $payment_amount . "', '" . $payment_data . "')");
                if ($transaction_id > 0) {
                    $db->query("UPDATE " . $db_config['prefix'] . "_" . $module_data . "_orders SET transaction_status=" . $nv_transaction_status . " , transaction_id = " . $transaction_id . " , transaction_count = transaction_count+1 WHERE order_id=" . $PaymentDetail['order_id']);
                } else {
                    $error_update = true;
                }
            }
            if (!$error_update) {
                // Cap nhat diem tich luy
                $data_content = array();
                $result = $db->query('SELECT * FROM ' . $db_config['prefix'] . '_' . $module_data . '_orders WHERE order_id=' . $order_id);
                $data_content = $result->fetch();
                if (!empty($data_content)) {
                    UpdatePoint($data_content);
                }
                $nv_redirect = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=history";
                $contents = redict_link($lang_module['payment_complete'], $lang_module['back_history'], $nv_redirect);
            }
        }
    }
}
redict_link("Unknow Error!!!", $lang_module['cart_back'], $BackUrl);