Exemplo n.º 1
0
 $stmt->bindParam(':parentid', $parentid, PDO::PARAM_INT);
 $stmt->bindParam(':title', $title, PDO::PARAM_STR);
 $stmt->bindParam(':titlesite', $titlesite, PDO::PARAM_STR);
 $stmt->bindParam(':alias', $alias, PDO::PARAM_STR);
 $stmt->bindParam(':image', $image, PDO::PARAM_STR);
 $stmt->bindParam(':viewdescription', $viewdescription, PDO::PARAM_STR);
 $stmt->bindParam(':keywords', $keywords, PDO::PARAM_STR);
 $stmt->bindParam(':description', $description, PDO::PARAM_STR, strlen($description));
 $stmt->bindParam(':descriptionhtml', $descriptionhtml, PDO::PARAM_STR, strlen($descriptionhtml));
 $stmt->bindParam(':groups_view', $groups_view, PDO::PARAM_STR);
 $stmt->bindParam(':featured', $featured, PDO::PARAM_INT);
 $stmt->bindParam(':ad_block_cat', $ad_block_cat, PDO::PARAM_STR);
 $stmt->execute();
 if ($stmt->rowCount()) {
     $check_ad_block_cat = explode(',', $ad_block_cat);
     $_r_b = nv_remove_block_botcat_news($catid);
     $_r_t = nv_remove_block_topcat_news($catid);
     if ($parentid != $parentid_old) {
         $weight = $db->query('SELECT max(weight) FROM ' . NV_PREFIXLANG . '_' . $module_data . '_cat WHERE parentid=' . $parentid)->fetchColumn();
         $weight = intval($weight) + 1;
         $sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . '_cat SET weight=' . $weight . ' WHERE catid=' . intval($catid);
         $db->query($sql);
         nv_fix_cat_order();
         nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['edit_cat'], $title, $admin_info['userid']);
     }
     if (in_array('1', $check_ad_block_cat)) {
         $ini_edit = nv_add_block_topcat_news($catid);
     }
     if (in_array('2', $check_ad_block_cat)) {
         $ini_edit2 = nv_add_block_botcat_news($catid);
     }
Exemplo n.º 2
0
function viewsubcat_main($viewcat, $array_cat)
{
    global $module_name, $module_file, $site_mods, $global_array_cat, $lang_module, $module_config, $module_info;
    $xtpl = new XTemplate($viewcat . '.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('TOOLTIP_POSITION', $module_config[$module_name]['tooltip_position']);
    $xtpl->assign('IMGWIDTH', $module_config[$module_name]['homewidth']);
    // Hien thi cac chu de con
    foreach ($array_cat as $key => $array_row_i) {
        if (isset($array_cat[$key]['content'])) {
            $array_row_i['rss'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $module_info['alias']['rss'] . "/" . $array_row_i['alias'];
            $xtpl->assign('CAT', $array_row_i);
            $catid = intval($array_row_i['catid']);
            $array_row_i['ad_block_cat'] = explode(',', $array_row_i['ad_block_cat']);
            $_block_topcat_by_id = '[' . strtoupper($module_name) . '_TOPCAT_' . $array_row_i['catid'] . ']';
            if (in_array('1', $array_row_i['ad_block_cat'])) {
                if (!nv_check_block_topcat_news($array_row_i['catid'])) {
                    nv_add_block_topcat_news($array_row_i['catid']);
                }
                $xtpl->assign('BLOCK_TOPCAT', $_block_topcat_by_id);
                $xtpl->parse('main.listcat.block_topcat');
            } else {
                if (nv_check_block_topcat_news($array_row_i['catid'])) {
                    nv_remove_block_topcat_news($array_row_i['catid']);
                }
            }
            $_block_bottomcat_by_id = '[' . strtoupper($module_name) . '_BOTTOMCAT_' . $array_row_i['catid'] . ']';
            if (in_array('2', $array_row_i['ad_block_cat'])) {
                if (!nv_check_block_block_botcat_news($array_row_i['catid'])) {
                    nv_add_block_botcat_news($array_row_i['catid']);
                }
                $xtpl->assign('BLOCK_BOTTOMCAT', $_block_bottomcat_by_id);
                $xtpl->parse('main.listcat.block_bottomcat');
            } else {
                if (nv_check_block_block_botcat_news($array_row_i['catid'])) {
                    nv_remove_block_botcat_news($array_row_i['catid']);
                }
            }
            if ($array_row_i['subcatid'] != '') {
                $_arr_subcat = explode(',', $array_row_i['subcatid']);
                $limit = 0;
                foreach ($_arr_subcat as $catid_i) {
                    if ($global_array_cat[$catid_i]['inhome'] == 1) {
                        $xtpl->assign('SUBCAT', $global_array_cat[$catid_i]);
                        $xtpl->parse('main.listcat.subcatloop');
                        $limit++;
                    }
                    if ($limit >= 3) {
                        $more = array('title' => $lang_module['more'], 'link' => $global_array_cat[$catid]['link']);
                        $xtpl->assign('MORE', $more);
                        $xtpl->parse('main.listcat.subcatmore');
                        break;
                    }
                }
            }
            $a = 0;
            foreach ($array_cat[$key]['content'] as $array_row_i) {
                $newday = $array_row_i['publtime'] + 86400 * $array_row_i['newday'];
                $array_row_i['publtime'] = nv_date('d/m/Y H:i', $array_row_i['publtime']);
                ++$a;
                if ($a == 1) {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->parse('main.listcat.newday');
                    }
                    $xtpl->assign('CONTENT', $array_row_i);
                    if ($array_row_i['imghome'] != "") {
                        $xtpl->assign('HOMEIMG', $array_row_i['imghome']);
                        $xtpl->assign('HOMEIMGALT', !empty($array_row_i['homeimgalt']) ? $array_row_i['homeimgalt'] : $array_row_i['title']);
                        $xtpl->parse('main.listcat.image');
                    }
                    if (defined('NV_IS_MODADMIN')) {
                        $xtpl->assign('ADMINLINK', nv_link_edit_page($array_row_i['id']) . " " . nv_link_delete_page($array_row_i['id']));
                        $xtpl->parse('main.listcat.adminlink');
                    }
                } else {
                    if ($newday >= NV_CURRENTTIME) {
                        $xtpl->assign('CLASS', 'icon_new_small');
                    } else {
                        $xtpl->assign('CLASS', 'icon_list');
                    }
                    $array_row_i['hometext'] = nv_clean60($array_row_i['hometext'], $module_config[$module_name]['tooltip_length'], true);
                    $xtpl->assign('OTHER', $array_row_i);
                    if ($module_config[$module_name]['showtooltip']) {
                        $xtpl->parse('main.listcat.related.loop.tooltip');
                    }
                    $xtpl->parse('main.listcat.related.loop');
                }
                if ($a > 1) {
                    $xtpl->assign('WCT', 'col-md-16 ');
                } else {
                    $xtpl->assign('WCT', 'col-md-24');
                }
                $xtpl->set_autoreset();
            }
            if ($a > 1) {
                $xtpl->parse('main.listcat.related');
            }
            if (isset($site_mods['comment']) and isset($module_config[$module_name]['activecomm']) and $module_config[$module_name]['activecomm']) {
                $xtpl->parse('main.listcat.comment');
            }
            $xtpl->parse('main.listcat');
        }
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}