Example #1
0
        $generate_page = nv_alias_page($page_title, $base_url, $num_items, $per_page, $page);
        $pl_ss = md5($playlist_id . session_id() . $global_config['sitekey']);
        $contents = playlist_theme($playlist_array, $playlist_other_array, $generate_page, $playlist_info, $playlist_id, $pl_ss);
    } else {
        Header('Location: ' . nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $module_info['alias']['playlists'], true));
        exit;
    }
} else {
    $playlist_info = '';
    $page_title = $module_info['custom_title'];
    $key_words = $module_info['keywords'];
    $playlist_info['title'] = $lang_module['playlist_show_list'];
    $result = $db->query('SELECT playlist_id as id, title, alias, image, hitstotal, description as hometext, keywords, add_time as publtime, private_mode, userid FROM ' . NV_PREFIXLANG . '_' . $module_data . '_playlist_cat WHERE status=1 ORDER BY weight ASC');
    while ($item = $result->fetch()) {
        if (!empty($item['image']) and file_exists(NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_upload . '/img/' . $item['image'])) {
            $item['src'] = creat_thumbs($item['id'], $item['image'], $module_upload, $module_config[$module_name]['homewidth'], $module_config[$module_name]['homeheight'], 90);
        } elseif (nv_is_url($item['image'])) {
            $item['src'] = $item['image'];
        } elseif (!empty($show_no_image)) {
            $item['src'] = NV_BASE_SITEURL . $show_no_image;
        } else {
            $item['src'] = '';
        }
        $item['alt'] = !empty($item['homeimgalt']) ? $item['homeimgalt'] : $item['title'];
        $item['width'] = $module_config[$module_name]['blockwidth'];
        $item['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $module_info['alias']['playlists'] . '/' . $item['alias'];
        $item['fake_id'] = 0;
        $db->sqlreset()->select('COUNT(*)')->from(NV_PREFIXLANG . '_' . $module_data . '_playlist')->where('playlist_id= ' . $item['id']);
        $num_items = $db->query($db->sql())->fetchColumn();
        $item['num_items'] = $num_items;
        if ($item['private_mode'] == 1 and $user_info['userid'] != $item['userid'] and !defined('NV_IS_MODADMIN')) {
 function nv_block_category_album($block_config)
 {
     global $module_photo_category, $module_info, $site_mods, $module_config, $lang_module, $global_config, $db, $blockID;
     $module = $block_config['module'];
     $thumb_width = $module_config[$module]['cr_thumb_width'];
     $thumb_height = $module_config[$module]['cr_thumb_height'];
     $thumb_quality = $module_config[$module]['cr_thumb_quality'];
     $mod_data = $site_mods[$module]['module_data'];
     $mod_file = $site_mods[$module]['module_file'];
     if (empty($block_config['category_id'])) {
         return '';
     }
     $category_id = implode(',', $block_config['category_id']);
     $db->sqlreset()->select('a.album_id, a.category_id, a.name, a.alias, a.capturelocal, a.description, a.num_photo, a.date_added, r.file, r.thumb')->from(NV_PREFIXLANG . '_' . $mod_data . '_album a LEFT JOIN  ' . NV_PREFIXLANG . '_' . $mod_data . '_rows r ON ( a.album_id = r.album_id )')->where('a.status= 1 AND a.category_id IN(' . $category_id . ') AND r.defaults = 1')->order('a.date_added DESC')->limit($block_config['numrow']);
     $list = nv_db_cache($db->sql(), 'album_id', $module);
     if (!empty($list)) {
         if (file_exists(NV_ROOTDIR . '/themes/' . $global_config['module_theme'] . '/modules/' . $mod_file . '/block_category_album.tpl')) {
             $block_theme = $global_config['module_theme'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block_category_album.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
         $xtpl->assign('BLOCK_ID', $blockID);
         $xtpl->assign('LANG', $lang_module);
         foreach ($list as $album) {
             $album['name'] = nv_clean60($album['name'], $block_config['title_length']);
             $album['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module . '&' . NV_OP_VARIABLE . '=' . $module_photo_category[$album['category_id']]['alias'] . '/' . $album['alias'] . '-' . $album['album_id'] . $global_config['rewrite_exturl'];
             $album['description'] = strip_tags(nv_clean60($album['description'], $block_config['des_length']));
             $album['datePublished'] = date('Y-m-d', $album['date_added']);
             $album['thumb'] = creat_thumbs($album['album_id'], $album['file'], $module, $thumb_width, $thumb_height, $thumb_quality);
             $album['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module . '/images/' . $album['file'];
             $xtpl->assign('ALBUM', $album);
             $xtpl->parse('main.loop_album');
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
Example #3
0
             $row['imghome'] = $row['homeimgfile'];
         } elseif (!empty($show_no_image)) {
             $row['imghome'] = NV_BASE_SITEURL . $show_no_image;
         } else {
             $row['imghome'] = '';
         }
         $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
         $related_new_array[] = array('title' => $row['title'], 'time' => $row['publtime'], 'link' => $link, 'newday' => $global_array_cat[$catid]['newday'], 'hometext' => $row['hometext'], 'imghome' => $row['imghome']);
     }
     $related->closeCursor();
     sort($related_new_array, SORT_NUMERIC);
     $db->sqlreset()->select('id, title, alias, publtime, homeimgfile, homeimgthumb, hometext')->from(NV_PREFIXLANG . '_' . $module_data . '_' . $catid)->where('status=1 AND publtime < ' . $publtime)->order('id DESC')->limit($st_links);
     $related = $db->query($db->sql());
     while ($row = $related->fetch()) {
         if ($row['homeimgthumb'] == 1 or $row['homeimgthumb'] == 2) {
             $row['imghome'] = creat_thumbs($row['id'], $row['homeimgfile'], $module_upload, $module_config[$module_name]['homewidth'], $module_config[$module_name]['homeheight'], 90);
         } elseif ($row['homeimgthumb'] == 3) {
             $row['imghome'] = $row['homeimgfile'];
         } elseif (!empty($show_no_image)) {
             $row['imghome'] = NV_BASE_SITEURL . $show_no_image;
         } else {
             $row['imghome'] = '';
         }
         $link = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . NV_OP_VARIABLE . '=' . $global_array_cat[$catid]['alias'] . '/' . $row['alias'] . '-' . $row['id'] . $global_config['rewrite_exturl'];
         $related_array[] = array('title' => $row['title'], 'time' => $row['publtime'], 'link' => $link, 'newday' => $global_array_cat[$catid]['newday'], 'hometext' => $row['hometext'], 'homeimgthumb' => $row['homeimgthumb'], 'imghome' => $row['imghome']);
     }
     $related->closeCursor();
     unset($related, $row);
 }
 if ($news_contents['allowed_rating']) {
     $time_set_rating = $nv_Request->get_int($module_name . '_' . $op . '_' . $news_contents['id'], 'cookie', 0);
Example #4
0
function search_result_theme($key, $numRecord, $per_pages, $page, $array_content, $catid)
{
    global $module_file, $module_info, $lang_module, $module_name, $module_upload, $global_photo_cat, $module_config, $global_config;
    $xtpl = new XTemplate('search.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('KEY', $key);
    $xtpl->assign('TITLE_MOD', $lang_module['search_module_title']);
    if (!empty($array_content)) {
        foreach ($array_content as $value) {
            $xtpl->assign('LINK', $global_photo_cat[$value['category_id']]['link'] . '/' . $value['alias'] . "-" . $value['album_id'] . $global_config['rewrite_exturl']);
            $xtpl->assign('TITLEROW', strip_tags(BoldKeywordInStr($value['name'], $key)));
            if (!empty($value['description'])) {
                $xtpl->assign('CONTENT', BoldKeywordInStr($value['description'], $key) . "...");
            }
            $xtpl->assign('TIME', nv_date('H:i d/m/Y', $value['date_added']));
            $value['src'] = creat_thumbs($value['album_id'], $value['file'], $module_upload, $module_config[$module_name]['cr_thumb_width'], $module_config[$module_name]['cr_thumb_height'], $module_config[$module_name]['cr_thumb_quality']);
            if (!empty($value['src'])) {
                $xtpl->assign('IMG_SRC', $value['src']);
                $xtpl->parse('results.result.result_img');
            }
            $xtpl->parse('results.result');
        }
    }
    if ($numRecord == 0) {
        $xtpl->assign('KEY', $key);
        $xtpl->assign('INMOD', $lang_module['search_modul_title']);
        $xtpl->parse('results.noneresult');
    }
    if ($numRecord > $per_pages) {
        $url_link = $_SERVER['REQUEST_URI'];
        if (strpos($url_link, '&page=') > 0) {
            $url_link = substr($url_link, 0, strpos($url_link, '&page='));
        } elseif (strpos($url_link, '?page=') > 0) {
            $url_link = substr($url_link, 0, strpos($url_link, '?page='));
        }
        $_array_url = array('link' => $url_link, 'amp' => '&page=');
        $generate_page = nv_generate_page($_array_url, $numRecord, $per_pages, $page);
        $xtpl->assign('VIEW_PAGES', $generate_page);
        $xtpl->parse('results.pages_result');
    }
    $xtpl->assign('NUMRECORD', $numRecord);
    $xtpl->assign('MY_DOMAIN', NV_MY_DOMAIN);
    $xtpl->parse('results');
    return $xtpl->text('results');
}
Example #5
0
        $where .= ' AND publtime >=' . mktime(0, 0, 0, $m[2], $m[1], $m[3]);
    }
    if ($catid > 0) {
        $table_search = NV_PREFIXLANG . '_' . $module_data . '_' . $catid;
    } else {
        $table_search = NV_PREFIXLANG . '_' . $module_data . '_rows';
    }
    $db->sqlreset()->select('COUNT(*)')->from($table_search . ' as tb1 ' . $tbl_src)->where('tb1.status=1 ' . $where);
    $numRecord = $db->query($db->sql())->fetchColumn();
    $db->select('tb1.id,tb1.title,tb1.alias,tb1.catid,tb1.hometext,tb1.author,tb1.publtime,tb1.homeimgfile, tb1.homeimgthumb,tb1.sourceid')->order('tb1.publtime DESC')->limit($per_page)->offset(($page - 1) * $per_page);
    $result = $db->query($db->sql());
    $array_content = array();
    $show_no_image = $module_config[$module_name]['show_no_image'];
    while (list($id, $title, $alias, $catid, $hometext, $author, $publtime, $homeimgfile, $homeimgthumb, $sourceid) = $result->fetch(3)) {
        if ($homeimgthumb == 1 or $homeimgthumb == 2) {
            $img_src = creat_thumbs($id, $homeimgfile, $module_upload, $module_config[$module_name]['homewidth'], $module_config[$module_name]['homeheight'], 90);
        } elseif ($homeimgthumb == 3) {
            $img_src = $homeimgfile;
        } elseif (!empty($show_no_image)) {
            $img_src = NV_BASE_SITEURL . $show_no_image;
        } else {
            $img_src = '';
        }
        $array_content[] = array('id' => $id, 'title' => $title, 'alias' => $alias, 'catid' => $catid, 'hometext' => $hometext, 'author' => $author, 'publtime' => $publtime, 'homeimgfile' => $img_src, 'sourceid' => $sourceid);
    }
    $contents .= search_result_theme($key, $numRecord, $per_page, $page, $array_content, $catid);
}
if (empty($key)) {
    $page_title = $lang_module['search_title'] . ' ' . NV_TITLEBAR_DEFIS . ' ' . $module_info['custom_title'];
} else {
    $page_title = $key . ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_module['search_title'];
 function nv_tab_catid($block_config)
 {
     global $module_array_cat, $module_info, $site_mods, $module_config, $global_config, $db;
     $module = $block_config['module'];
     $mod_data = $site_mods[$module]['module_data'];
     $mod_file = $site_mods[$module]['module_file'];
     $numrow = !empty($block_config['config_numrow']) ? $block_config['config_numrow'] : 6;
     $show_no_image = $module_config[$module]['show_no_image'];
     if (isset($module_array_cat[$block_config['config_catid']]) && !empty($module_array_cat[$block_config['config_catid']])) {
         if (file_exists(NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $mod_file . '/block_tab_catid.tpl')) {
             $block_theme = $module_info['template'];
         } else {
             $block_theme = 'default';
         }
         $xtpl = new XTemplate('block_tab_catid.tpl', NV_ROOTDIR . '/themes/' . $block_theme . '/modules/' . $mod_file);
         $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
         $xtpl->assign('TEMPLATE', $block_theme);
         if (!defined('LOAD_SCRIPT_TAB')) {
             $xtpl->parse('main.load_script_tab');
             define('LOAD_SCRIPT_TAB', true);
         }
         $cat_news = $module_array_cat[$block_config['config_catid']];
         $array_cat = getParentSub($cat_news['catid']);
         $data_content = array();
         $cache_file = NV_LANG_DATA . '_' . md5(implode(',', $array_cat)) . '_' . NV_CACHE_PREFIX . '.cache';
         if (($cache = nv_get_cache($module, $cache_file)) != false) {
             $data_content = unserialize($cache);
         } else {
             foreach ($array_cat as $_catid) {
                 if ($module_array_cat[$_catid]['parentid'] == 0) {
                     $where = 'WHERE status= 1 AND catid IN ( ' . implode(',', $array_cat) . ' )';
                 } else {
                     $where = 'WHERE status= 1 AND catid=' . $_catid;
                 }
                 $result = $db->query('SELECT id, catid, title, alias, homeimgfile, homeimgthumb, homeimgalt, publtime FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_rows ' . $where . ' ORDER BY publtime DESC LIMIT ' . intval($numrow));
                 $data = array();
                 while ($l = $result->fetch()) {
                     $l['title_cut'] = nv_clean60($l['title'], $block_config['config_numcut']);
                     $l['link'] = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&amp;' . NV_NAME_VARIABLE . '=' . $module . '&amp;' . NV_OP_VARIABLE . '=' . $module_array_cat[$l['catid']]['alias'] . '/' . $l['alias'] . '-' . $l['id'] . $global_config['rewrite_exturl'];
                     if ($l['homeimgthumb'] == 1) {
                         $l['thumb'] = NV_BASE_SITEURL . NV_FILES_DIR . '/' . $module . '/' . $l['homeimgfile'];
                     } elseif ($l['homeimgthumb'] == 2) {
                         $l['thumb'] = creat_thumbs($l['id'], $l['homeimgfile'], $module, 100, 100);
                     } elseif ($l['homeimgthumb'] == 3) {
                         $l['thumb'] = $l['homeimgfile'];
                     } elseif (!empty($show_no_image)) {
                         $l['thumb'] = NV_BASE_SITEURL . $show_no_image;
                     } else {
                         $l['thumb'] = '';
                     }
                     $data[] = $l;
                 }
                 $data_content[$_catid] = array('catid' => $_catid, 'title' => $module_array_cat[$_catid]['title'], 'alias' => $module_array_cat[$_catid]['alias'], 'content' => $data);
             }
             $cache = serialize($data_content);
             nv_set_cache($module, $cache_file, $cache);
         }
         $xtpl->assign('TAB_TOTAL', count($data_content));
         $xtpl->assign('TAB_NAME', $block_config['config_catid']);
         if (!empty($data_content)) {
             $a = 0;
             foreach ($data_content as $_catid => $data) {
                 $xtpl->assign('NUM', $a);
                 $xtpl->assign('CAT', $data);
                 $xtpl->parse('main.loopcat');
                 $b = 1;
                 foreach ($data['content'] as $loop) {
                     if ($b % 3 == 0) {
                         $xtpl->parse('main.loop.loopcontent.clear');
                     }
                     $loop['style'] = $a == 0 ? 'display: block' : 'display: none';
                     $xtpl->assign('LOOP', $loop);
                     $xtpl->parse('main.loop.loopcontent');
                     ++$b;
                 }
                 $xtpl->parse('main.loop');
                 ++$a;
             }
         }
         $xtpl->parse('main');
         return $xtpl->text('main');
     }
 }
Example #7
0
/**
 * detail_album()
 * 
 * @param mixed $album
 * @return
 */
function detail_album($album, $array_photo, $other_category_album)
{
    global $global_config, $category_id, $client_info, $global_photo_cat, $module_name, $module_upload, $module_file, $lang_module, $photo_config, $module_info, $op;
    $xtpl = new XTemplate('detail_album.tpl', NV_ROOTDIR . '/themes/' . $module_info['template'] . '/modules/' . $module_file);
    $xtpl->assign('LANG', $lang_module);
    $xtpl->assign('NV_BASE_SITEURL', NV_BASE_SITEURL);
    $xtpl->assign('TEMPLATE', $module_info['template']);
    $xtpl->assign('MODULE_FILE', $module_file);
    $xtpl->assign('OP', $op);
    $xtpl->assign('CATALOG', $global_photo_cat[$category_id]);
    $xtpl->assign('SELFURL', $client_info['selfurl']);
    if (!empty($album)) {
        // $ratingwidth = ( $album['total_rating'] > 0 ) ? ( $album['total_rating'] * 100 / ( $album['click_rating'] * 5 ) ) * 0.01 : 0;
        // $xtpl->assign( 'RATINGVALUE', ( $album['total_rating'] > 0 ) ? round( $album['total_rating']/$album['click_rating'], 1) : 0 );
        // $xtpl->assign( 'RATINGCOUNT', $album['total_rating'] );
        // $xtpl->assign( 'RATINGWIDTH', round( $ratingwidth, 2) );
        // $xtpl->assign( 'LINK_RATE', NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=rating&album_id=' . $album['album_id'] );
        $album['description'] = strip_tags(nv_clean60($album['description'], 100));
        $album['datePublished'] = date('Y-m-d', $album['date_added']);
        $xtpl->assign('ALBUM', $album);
        $num = 0;
        if (!empty($array_photo)) {
            foreach ($array_photo as $photo) {
                $photo['thumb'] = creat_thumbs($photo['row_id'], $photo['file'], $module_upload, 300, 210, 90);
                //$photo['thumb'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/thumb/' . $photo['thumb'];
                $photo['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/images/' . $photo['file'];
                $photo['description'] = !empty($photo['description']) ? $photo['description'] : $photo['name'];
                $photo['num'] = $num;
                $photo['link_img'] = $global_photo_cat[$category_id]['link'] . '/' . $album['alias'] . '-' . $photo['album_id'] . '/' . $photo['row_id'] . $global_config['rewrite_exturl'];
                $xtpl->assign('PHOTO', $photo);
                $xtpl->parse('main.view_grid.loop_img');
                //$xtpl->parse( 'main.view_grid' );
                ++$num;
            }
        }
    }
    if (!empty($other_category_album)) {
        $key = 1;
        foreach ($other_category_album as $other) {
            $other['description'] = strip_tags(nv_clean60($other['description'], 100));
            $other['datePublished'] = date('Y-m-d', $other['date_added']);
            $other['thumb'] = creat_thumbs($other['album_id'], $other['file'], $module_upload, 270, 210, 90);
            $other['file'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/images/' . $other['file'];
            $other['key'] = $key;
            $xtpl->assign('OTHER', $other);
            $xtpl->parse('main.loop_album');
            ++$key;
        }
    }
    if ($photo_config = 'album_view_grid') {
        $xtpl->parse('main.view_grid');
        //$xtpl->parse( 'main.view_grid' );
    } else {
        $xtpl->parse('main.view_slider');
        $xtpl->parse('main.view_slider');
    }
    $xtpl->parse('main');
    return $xtpl->text('main');
}