Skip to content

Commit

Permalink
Merge pull request #1 from nukeviet/master
Browse files Browse the repository at this point in the history
update code
  • Loading branch information
thuvp1995 authored Nov 8, 2017
2 parents 1dbe582 + 99e7490 commit 0cb9f3c
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 82 deletions.
36 changes: 18 additions & 18 deletions modules/dispatch/blocks/global.block_category.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

/**
* nv_block_config_dispathch_category()
*
*
* @param mixed $module
* @param mixed $data_block
* @param mixed $lang_block
Expand All @@ -27,7 +27,7 @@ function nv_block_config_dispathch_category($module, $data_block, $lang_block)
$html .= "<option value=\"\">" . $lang_block['title_length'] . "</option>\n";
for ($i = 0; $i < 100; $i++) {
$sel = ($data_block['title_length'] == $i) ? ' selected' : '';

$html .= "<option value=\"" . $i . "\" " . $sel . ">" . $i . "</option>\n";
}
$html .= "</select></td>\n";
Expand All @@ -36,7 +36,7 @@ function nv_block_config_dispathch_category($module, $data_block, $lang_block)

/**
* nv_block_config_dispathch_category_submit()
*
*
* @param mixed $module
* @param mixed $lang_block
* @return
Expand All @@ -53,50 +53,50 @@ function nv_block_config_dispathch_category_submit($module, $lang_block)

/**
* nv_dispathch_category()
*
*
* @param mixed $block_config
* @return
*/
function nv_dispathch_category($block_config)
{
global $module_array_cat, $module_info, $lang_module, $site_mods, $global_config;

$module = $block_config['module'];
$module_file = $site_mods[$module]['module_file'];

if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file . '/block_category.tpl')) {
$block_theme = $module_info['template'];
} elseif (file_exists(NV_ROOTDIR . '/themes/' . $global_config['site_theme'] . '/modules/' . $module_file . '/block_category.tpl')) {
$block_theme = $global_config['site_theme'];
} else {
$block_theme = 'default';
}
$xtpl = new XTemplate("block_category.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $module_file);

$xtpl = new XTemplate("block_category.tpl", NV_ROOTDIR . "/themes/" . $block_theme . "/modules/" . $module_info['module_theme']);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('NV_ASSETS_DIR', NV_ASSETS_DIR);
$xtpl->assign('TEMPLATE', $block_theme);

$arr = array();

if (!empty($module_array_cat)) {
$title_length = $block_config['title_length'];
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('BLOCK_ID', $block_config['bid']);
$xtpl->assign('TEMPLATE', $module_info['template']);
$html = "";

foreach ($module_array_cat as $cat) {

if ($cat['parentid'] == 0) {

$html .= "<li>\n";
$html .= "<a title=\"" . $cat['title'] . "\" href=\"" . $cat['link'] . "\">" . nv_clean60($cat['title'], $title_length) . "</a>\n";
if (!empty($cat['subcatid'])) $html .= nv_dispathch_sub_category($cat['subcatid'], $title_length);
$html .= "</li>\n";
}
}

$xtpl->assign('HTML_CONTENT', $html);
$xtpl->parse('main');
return $xtpl->text('main');
Expand All @@ -105,7 +105,7 @@ function nv_dispathch_category($block_config)

/**
* nv_dispathch_sub_category()
*
*
* @param mixed $list_sub
* @param mixed $title_length
* @return
Expand All @@ -119,7 +119,7 @@ function nv_dispathch_sub_category($list_sub, $title_length)
$list = explode(",", $list_sub);
$html = "<ul>\n";
foreach ($list as $catid) {

$html .= "<li>\n";
$html .= "<a title=\"" . $module_array_cat[$catid]['title'] . "\" href=\"" . $module_array_cat[$catid]['link'] . "\">" . nv_clean60($module_array_cat[$catid]['title'], $title_length) . "</a>\n";
if (!empty($module_array_cat[$catid]['subcatid'])) $html .= nv_dispathch_sub_category($module_array_cat[$catid]['subcatid'], $title_length);
Expand Down Expand Up @@ -149,9 +149,9 @@ function nv_dispathch_sub_category($list_sub, $title_length)
$module_array_cat[$module_array_cat[$l['id']]['parentid']]['subcatid'] = $module_array_cat[$module_array_cat[$l['id']]['parentid']]['subcatid'] . "," . $module_array_cat[$l['id']]['id'];
}
}

}

$content = nv_dispathch_category($block_config);
}
}
10 changes: 5 additions & 5 deletions modules/dispatch/blocks/module.block_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
function nv_dispathch_view($block_config)
{
global $module_data, $module_name, $module_file, $global_array_cat, $lang_module, $my_head, $db, $module_info;
$xtpl = new XTemplate("block_hits.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file);

$xtpl = new XTemplate("block_hits.tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_info['module_theme']);
$xtpl->assign('BASESITE', NV_BASE_SITEURL);
$xtpl->assign('LANG', $lang_module);

$sql = "SELECT id, alias, title, code FROM " . NV_PREFIXLANG . "_" . $module_data . "_document ORDER BY view DESC, id DESC LIMIT 0 , 10";
$result = $db->query($sql);
$chk_topview = $result->rowCount();

if ($chk_topview) {
$i = 1;
while ($row = $result->fetch()) {
Expand All @@ -33,7 +33,7 @@ function nv_dispathch_view($block_config)
}
$xtpl->parse('main.topviews');
}

$xtpl->parse('main');
return $xtpl->text('main');
}
Expand Down
46 changes: 23 additions & 23 deletions modules/dispatch/funcs/detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

if (!defined('NV_IS_MOD_CONGVAN')) die('Stop!!!');

$page_title = $module_info['custom_title'];
$page_title = $module_info['site_title'];
$key_words = $module_info['keywords'];

$fileupload = array();
Expand All @@ -19,21 +19,21 @@
if (isset($array_op[1]) and preg_match("/^([a-zA-Z0-9\-\_]+)\-([\d]+)$/", $array_op[1], $matches)) {
$id = $matches[2];
$alias = $matches[0];

$listcats = nv_listcats(0);
$listdes = nv_listdes(0);

$sql = "SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_document WHERE id=" . $id . " AND alias=" . $db->quote($alias);

$result = $db->query($sql);
$num = $result->rowCount();
if ($num != 1) {
Header("Location: " . nv_url_rewrite(NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name, 1));
exit();
}

$row = $result->fetch();

$row['cat'] = $listcats[$row['catid']]['title'];
$row['status'] = $arr_status[$row['status']]['name'];
if ($row['from_time'] != 0) {
Expand All @@ -48,22 +48,22 @@
} else {
$row['date_die'] = '';
}

$row['type_title'] = $arr_type[$row['type']]['title'];

if ($row['from_depid'] != 0) {
$row['from_depid'] = $listdes[$row['from_depid']]['title'];
}

$query = "UPDATE " . NV_PREFIXLANG . "_" . $module_data . "_document SET view=view+1 WHERE id=" . $id;

$db->query($query);

$listtypes = nv_listtypes($row['type']);

$row['view'] = $row['view'] + 1;
$xtpl = new XTemplate($op . ".tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_file . "/");

$xtpl = new XTemplate($op . ".tpl", NV_ROOTDIR . "/themes/" . $module_info['template'] . "/modules/" . $module_info['module_theme'] . "/");
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('GLANG', $lang_global);
$xtpl->assign('MODULE_URL', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . "&" . NV_OP_VARIABLE . "=main&type=" . $row['type']);
Expand All @@ -79,24 +79,24 @@
$xtpl->assign('template', $module_info['template']);
$xtpl->assign('module', $module_name);
$xtpl->assign('MODULE_LINK', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name);

$xtpl->assign('TYPELINK', NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=main&type=" . $row['type']);
$xtpl->assign('TYPENAME', $listtypes[$row['type']]['title']);
$xtpl->parse('main.if_cat');

$xtpl->assign('ROW', $row);

$sql = "SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_de_do WHERE doid=" . $id;
$re = $db->query($sql);
if ($re->rowCount()) {
while ($ro = $re->fetch()) {
$listdes = nv_listdes($ro['deid']);

$xtpl->assign('dis_de', $listdes[$ro['deid']]['title']);
$xtpl->parse('main.depid');
}
}

if (!empty($row['file'])) {
$fileupload = explode(",", $row['file']);
foreach ($fileupload as $f) {
Expand All @@ -105,7 +105,7 @@
}
$xtpl->parse('main.taifile');
}

$sql = "SELECT * FROM " . NV_PREFIXLANG . "_" . $module_data . "_de_do WHERE doid=" . $id;
$result = $db->query($sql);
$num = $result->rowCount();
Expand All @@ -118,14 +118,14 @@
$row['name'] = $listdes[$row['deid']]['title'];
$xtpl->assign('DATA', $row);
$xtpl->parse('main.de.loop');

}
$xtpl->parse('main.de');
}

$xtpl->parse('main');
$contents = $xtpl->text('main');

include NV_ROOTDIR . '/includes/header.php';
echo nv_site_theme($contents);
include NV_ROOTDIR . '/includes/footer.php';
Expand Down
24 changes: 12 additions & 12 deletions modules/dispatch/funcs/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

if (!defined('NV_IS_MOD_CONGVAN')) die('Stop!!!');

$page_title = $module_info['custom_title'];
$page_title = $module_info['site_title'];
$key_words = $module_info['keywords'];
$se = $from = $to = $from_signer = 0;
$type = '';
Expand Down Expand Up @@ -45,48 +45,48 @@
if ($row = $re->fetch()) {
$a_t[] = $row['id'];
}

$sql .= " AND type IN (" . implode(',', $a_t) . ")";

$base_url .= "&amp;type=" . $type;
}
}

if ($nv_Request->isset_request("from", "get")) {

$from = $nv_Request->get_title('from', 'get,post', '');

unset($m);
if (preg_match("/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/", $from, $m)) {
$from = mktime(0, 0, 0, $m[2], $m[1], $m[3]);
} else {
$from = 0;
}

if ($from != 0) {
$sql .= " AND from_time >= " . $from;
$base_url .= "&amp;from =" . $from;
}
}
if ($nv_Request->isset_request("to", "get")) {
$to = $nv_Request->get_title('to', 'get,post', '');

unset($m);
if (preg_match("/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/", $to, $m)) {
$to = mktime(0, 0, 0, $m[2], $m[1], $m[3]);
} else {
$to = 0;
}
if ($to != 0) {

$sql .= " AND from_time <= " . $to;
$base_url .= "&amp;to=" . $to;
}
}

if ($nv_Request->isset_request("from_signer", "get")) {
$from_signer = $nv_Request->get_int('from_signer', 'get', 0);

if ($from_signer != 0) {
$sql .= " AND from_signer=" . $from_signer;
$base_url .= "&amp;from_signer=" . $from_signer;
Expand Down Expand Up @@ -138,7 +138,7 @@

while ($row = $query2->fetch()) {
$i = $i + 1;

if ($listtypes[$row['type']]['status'] == 1 && nv_user_in_groups($row['groups_view'])) {
if (nv_date('d.m.Y', $row['from_time']) == nv_date('d.m.Y', NV_CURRENTTIME)) {
$row['code'] = $row['code'] . "<img src=\"" . NV_BASE_SITEURL . "themes/" . $module_info['template'] . "/images/" . $module_file . "/new.gif\">";
Expand All @@ -149,9 +149,9 @@
$row['to_org'] = '- ' . $row['to_org'];
if (strpos($row['to_org'], ',')) {
$row['to_org'] = str_replace(',', '<br />- ', $row['to_org']);

}

$array[$row['id']] = array(
'id' => (int) $row['id'],
'stt' => $i,
Expand Down
Loading

0 comments on commit 0cb9f3c

Please sign in to comment.