PageRenderTime 50ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/nukeviet/modules/weblinks/funcs/viewcat.php

http://nuke-viet.googlecode.com/
PHP | 87 lines | 63 code | 18 blank | 6 comment | 12 complexity | e5da841d3f3890524076766fc13275d6 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.1, GPL-2.0
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.x
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @Copyright (C) 2012 VINADES.,JSC. All rights reserved
  6. * @Createdate 3-6-2010 0:14
  7. */
  8. if( ! defined( 'NV_IS_MOD_WEBLINKS' ) ) die( 'Stop!!!' );
  9. global $global_array_cat;
  10. $page_title = $global_array_cat[$catid]['title'];
  11. $key_words = $global_array_cat[$catid]['keywords'];
  12. $description = $global_array_cat[$catid]['description'];
  13. $items = array();
  14. $array_subcat = array();
  15. $array_cat = array();
  16. foreach( $global_array_cat as $array_cat_i )
  17. {
  18. if( $array_cat_i['parentid'] == $catid )
  19. {
  20. $array_subcat[] = array(
  21. "title" => $array_cat_i['title'],
  22. "link" => $array_cat_i['link'],
  23. "count_link" => $array_cat_i['count_link']
  24. );
  25. }
  26. }
  27. $array_cat[] = array(
  28. "title" => $global_array_cat[$catid]['title'],
  29. "link" => $global_array_cat[$catid]['link'],
  30. "description" => $global_array_cat[$catid]['description']
  31. );
  32. $sort = ( $weblinks_config['sort'] == 'des' ) ? 'desc' : 'asc';
  33. if( $weblinks_config['sortoption'] == 'byhit' ) $orderby = 'hits_total ';
  34. elseif( $weblinks_config['sortoption'] == 'byid' ) $orderby = 'id ';
  35. elseif( $weblinks_config['sortoption'] == 'bytime' ) $orderby = 'add_time ';
  36. else $orderby = 'rand() ';
  37. $base_url = $global_array_cat[$catid]['link'];
  38. $sql = "SELECT SQL_CALC_FOUND_ROWS `id`, `author`, `title`, `alias`, `url`, `urlimg`, `add_time`, `description`,`hits_total` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE status='1' AND catid='" . $catid . "' ORDER BY " . $orderby . $sort . " LIMIT " . ( $page - 1 ) * $per_page . "," . $per_page;
  39. $result = $db->sql_query( $sql );
  40. $result_all = $db->sql_query( "SELECT FOUND_ROWS()" );
  41. list( $all_page ) = $db->sql_fetchrow( $result_all );
  42. while( $row = $db->sql_fetchrow( $result ) )
  43. {
  44. $author = explode( '|', $row['author'] );
  45. if( $author[0] == 1 )
  46. {
  47. $sql1 = "SELECT * FROM `" . NV_AUTHORS_GLOBALTABLE . "` WHERE `id`=" . $author[1] . "";
  48. $result1 = $db->sql_query( $sql1 );
  49. $row1 = $db->sql_fetchrow( $result1 );
  50. $row['author'] = $row1;
  51. }
  52. $row['link'] = $global_array_cat[$catid]['link'] . "/" . $row['alias'] . "-" . $row['id'];
  53. $row['visit'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=visitlink-" . $row['alias'] . "-" . $row['id'];
  54. $row['report'] = NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=reportlink-" . $row['alias'] . "-" . $row['id'];
  55. $urlimg = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $row['urlimg'];
  56. $imageinfo = nv_ImageInfo( $urlimg, 300, true, NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb' );
  57. $row['urlimg'] = $imageinfo['src'];
  58. $items[] = $row;
  59. }
  60. $contents = call_user_func( "viewcat", $array_subcat, $array_cat, $items );
  61. $contents .= nv_alias_page( $page_title, $base_url, $all_page, $per_page, $page );
  62. if( $page > 1 )
  63. {
  64. $page_title .= ' ' . NV_TITLEBAR_DEFIS . ' ' . $lang_global['page'] . ' ' . $page;
  65. }
  66. include ( NV_ROOTDIR . "/includes/header.php" );
  67. echo nv_site_theme( $contents );
  68. include ( NV_ROOTDIR . "/includes/footer.php" );
  69. ?>