PageRenderTime 46ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/news/admin/content.php

http://viet-group.googlecode.com/
PHP | 866 lines | 777 code | 69 blank | 20 comment | 125 complexity | 4db718a8388e2b7bc7b19a932878f319 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * @Project NUKEVIET 3.0
  4. * @Author VINADES.,JSC (contact@vinades.vn)
  5. * @Copyright (C) 2010 VINADES.,JSC. All rights reserved
  6. * @Createdate 2-9-2010 14:43
  7. */
  8. if ( ! defined( 'NV_IS_FILE_ADMIN' ) ) die( 'Stop!!!' );
  9. if ( defined( 'NV_EDITOR' ) )
  10. {
  11. require_once ( NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php' );
  12. }
  13. $username_alias = change_alias( $admin_info['username'] );
  14. $array_structure_image = array();
  15. $array_structure_image[''] = $module_name;
  16. $array_structure_image['Y'] = $module_name . '/' . date( 'Y' );
  17. $array_structure_image['Ym'] = $module_name . '/' . date( 'Y_m' );
  18. $array_structure_image['Y_m'] = $module_name . '/' . date( 'Y/m' );
  19. $array_structure_image['Ym_d'] = $module_name . '/' . date( 'Y_m/d' );
  20. $array_structure_image['Y_m_d'] = $module_name . '/' . date( 'Y/m/d' );
  21. $array_structure_image['username'] = $module_name . '/' . $username_alias;
  22. $array_structure_image['username_Y'] = $module_name . '/' . $username_alias . '/' . date( 'Y' );
  23. $array_structure_image['username_Ym'] = $module_name . '/' . $username_alias . '/' . date( 'Y_m' );
  24. $array_structure_image['username_Y_m'] = $module_name . '/' . $username_alias . '/' . date( 'Y/m' );
  25. $array_structure_image['username_Ym_d'] = $module_name . '/' . $username_alias . '/' . date( 'Y_m/d' );
  26. $array_structure_image['username_Y_m_d'] = $module_name . '/' . $username_alias . '/' . date( 'Y/m/d' );
  27. $structure_upload = isset( $module_config[$module_name]['structure_upload'] ) ? $module_config[$module_name]['structure_upload'] : "Ym";
  28. $currentpath = isset( $array_structure_image[$structure_upload] ) ? $array_structure_image[$structure_upload] : '';
  29. if ( file_exists( NV_UPLOADS_REAL_DIR . '/' . $currentpath ) )
  30. {
  31. $upload_real_dir_page = NV_UPLOADS_REAL_DIR . '/' . $currentpath;
  32. }
  33. else
  34. {
  35. $upload_real_dir_page = NV_UPLOADS_REAL_DIR . '/' . $module_name;
  36. $e = explode( "/", $currentpath );
  37. if ( ! empty( $e ) )
  38. {
  39. $cp = "";
  40. foreach ( $e as $p )
  41. {
  42. if ( ! empty( $p ) and ! is_dir( NV_UPLOADS_REAL_DIR . '/' . $cp . $p ) )
  43. {
  44. $mk = nv_mkdir( NV_UPLOADS_REAL_DIR . '/' . $cp, $p );
  45. nv_loadUploadDirList( false );
  46. if ( $mk[0] > 0 )
  47. {
  48. $upload_real_dir_page = $mk[2];
  49. }
  50. }
  51. elseif ( ! empty( $p ) )
  52. {
  53. $upload_real_dir_page = NV_UPLOADS_REAL_DIR . '/' . $cp . $p;
  54. }
  55. $cp .= $p . '/';
  56. }
  57. }
  58. $upload_real_dir_page = str_replace( "\\", "/", $upload_real_dir_page );
  59. }
  60. $currentpath = str_replace( NV_ROOTDIR . "/", "", $upload_real_dir_page );
  61. $uploads_dir_user = NV_UPLOADS_DIR . '/' . $module_name;
  62. if ( ! defined( 'NV_IS_SPADMIN' ) and strpos( $structure_upload, 'username' ) !== false )
  63. {
  64. $array_currentpath = explode( '/', $currentpath );
  65. if ( $array_currentpath[2] == $username_alias )
  66. {
  67. $uploads_dir_user = NV_UPLOADS_DIR . '/' . $module_name . '/' . $username_alias;
  68. }
  69. }
  70. $array_block_cat_module = array();
  71. $id_block_content = array();
  72. $sql = "SELECT bid, adddefault, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block_cat` ORDER BY `weight` ASC";
  73. $result = $db->sql_query( $sql );
  74. while ( list( $bid_i, $adddefault_i, $title_i ) = $db->sql_fetchrow( $result ) )
  75. {
  76. $array_block_cat_module[$bid_i] = $title_i;
  77. if ( $adddefault_i )
  78. {
  79. $id_block_content[] = $bid_i;
  80. }
  81. }
  82. $catid = $nv_Request->get_int( 'catid', 'get', 0 );
  83. $parentid = $nv_Request->get_int( 'parentid', 'get', 0 );
  84. $array_imgposition = array(
  85. 0 => $lang_module['imgposition_0'], 1 => $lang_module['imgposition_1'], 2 => $lang_module['imgposition_2']
  86. );
  87. $rowcontent = array(
  88. "id" => "", "listcatid" => "" . $catid . "," . $parentid . "", "topicid" => "", "admin_id" => $admin_id, "author" => "", "sourceid" => 0, "addtime" => NV_CURRENTTIME, "edittime" => NV_CURRENTTIME, "status" => 0, "publtime" => NV_CURRENTTIME, "exptime" => 0, "archive" => 1, "title" => "", "alias" => "", "hometext" => "", "homeimgfile" => "", "homeimgalt" => "", "homeimgthumb" => "", "imgposition" => 1, "bodytext" => "", "copyright" => 0, "inhome" => 1, "allowed_comm" => $module_config[$module_name]['setcomm'], "allowed_rating" => 1, "allowed_send" => 1, "allowed_print" => 1, "allowed_save" => 1, "hitstotal" => 0, "hitscm" => 0, "total_rating" => 0, "click_rating" => 0, "keywords" => ""
  89. );
  90. $rowcontent['sourcetext'] = "";
  91. $rowcontent['topictext'] = "";
  92. $page_title = $lang_module['content_add'];
  93. $error = array();
  94. $groups_list = nv_groups_list();
  95. $rowcontent['id'] = $nv_Request->get_int( 'id', 'get,post', 0 );
  96. if ( $rowcontent['id'] > 0 )
  97. {
  98. $check_permission = false;
  99. $rowcontent = $db->sql_fetchrow( $db->sql_query( "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` where `id`=" . $rowcontent['id'] . "" ) );
  100. if ( ! empty( $rowcontent['id'] ) )
  101. {
  102. $arr_catid = explode( ",", $rowcontent['listcatid'] );
  103. if ( defined( 'NV_IS_ADMIN_MODULE' ) )
  104. {
  105. $check_permission = true;
  106. }
  107. else
  108. {
  109. $check_edit = 0;
  110. if ( $rowcontent['status'] == 0 )
  111. {
  112. $edit_status = 0;
  113. }
  114. elseif ( $rowcontent['publtime'] < NV_CURRENTTIME and ( $rowcontent['exptime'] == 0 or $rowcontent['exptime'] > NV_CURRENTTIME ) )
  115. {
  116. $edit_status = 1;
  117. }
  118. elseif ( $rowcontent['publtime'] > NV_CURRENTTIME )
  119. {
  120. $edit_status = 2;
  121. }
  122. else
  123. {
  124. $edit_status = 3;
  125. }
  126. foreach ( $arr_catid as $catid_i )
  127. {
  128. if ( isset( $array_cat_admin[$admin_id][$catid_i] ) )
  129. {
  130. if ( $array_cat_admin[$admin_id][$catid_i]['admin'] == 1 )
  131. {
  132. $check_edit ++;
  133. }
  134. else
  135. {
  136. if ( $array_cat_admin[$admin_id][$catid_i]['edit_content'] == 1 )
  137. {
  138. $check_edit ++;
  139. }
  140. elseif ( $array_cat_admin[$admin_id][$catid_i]['pub_content'] == 1 and ( $edit_status == 0 or $edit_status = 2 ) )
  141. {
  142. $check_edit ++;
  143. }
  144. elseif ( $status == 0 and $post_id == $admin_id )
  145. {
  146. $check_edit ++;
  147. }
  148. }
  149. }
  150. }
  151. if ( $check_edit == count( $arr_catid ) )
  152. {
  153. $check_permission = true;
  154. }
  155. }
  156. }
  157. if ( ! $check_permission )
  158. {
  159. Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "" );
  160. die();
  161. }
  162. $page_title = $lang_module['content_edit'];
  163. $rowcontent['sourcetext'] = "";
  164. $rowcontent['topictext'] = "";
  165. $id_block_content = array();
  166. $sql = "SELECT bid FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block` where `id`='" . $rowcontent['id'] . "' ";
  167. $result = $db->sql_query( $sql );
  168. while ( list( $bid_i ) = $db->sql_fetchrow( $result ) )
  169. {
  170. $id_block_content[] = $bid_i;
  171. }
  172. }
  173. $array_cat_add_content = $array_cat_pub_content = $array_cat_edit_content = array();
  174. foreach ( $global_array_cat as $catid_i => $array_value )
  175. {
  176. $check_add_content = $check_pub_content = $check_edit_content = false;
  177. if ( defined( 'NV_IS_ADMIN_MODULE' ) )
  178. {
  179. $check_add_content = $check_pub_content = $check_edit_content = true;
  180. }
  181. elseif ( isset( $array_cat_admin[$admin_id][$catid_i] ) )
  182. {
  183. if ( $array_cat_admin[$admin_id][$catid_i]['admin'] == 1 )
  184. {
  185. $check_add_content = $check_pub_content = $check_edit_content = true;
  186. }
  187. else
  188. {
  189. if ( $array_cat_admin[$admin_id][$catid_i]['add_content'] == 1 )
  190. {
  191. $check_add_content = true;
  192. }
  193. if ( $array_cat_admin[$admin_id][$catid_i]['pub_content'] == 1 )
  194. {
  195. $check_pub_content = true;
  196. }
  197. if ( $array_cat_admin[$admin_id][$catid_i]['edit_content'] == 1 )
  198. {
  199. $check_edit_content = true;
  200. }
  201. }
  202. }
  203. if ( $check_add_content )
  204. {
  205. $array_cat_add_content[] = $catid_i;
  206. }
  207. if ( $check_pub_content )
  208. {
  209. $array_cat_pub_content[] = $catid_i;
  210. }
  211. if ( $check_edit_content )
  212. {
  213. $array_cat_edit_content[] = $catid_i;
  214. }
  215. }
  216. if ( $nv_Request->get_int( 'save', 'post' ) == 1 )
  217. {
  218. $catids = array_unique( $nv_Request->get_typed_array( 'catids', 'post', 'int', array() ) );
  219. $id_block_content = array_unique( $nv_Request->get_typed_array( 'bids', 'post', 'int', array() ) );
  220. $rowcontent['listcatid'] = implode( ",", $catids );
  221. $rowcontent['status'] = ( $nv_Request->isset_request( 'status1', 'post' ) ) ? 1 : 0;
  222. if ( $rowcontent['status'] and $rowcontent['publtime'] > NV_CURRENTTIME )
  223. {
  224. $array_cat_check_content = $array_cat_pub_content;
  225. }
  226. elseif ( $rowcontent['status'] )
  227. {
  228. $array_cat_check_content = $array_cat_edit_content;
  229. }
  230. else
  231. {
  232. $array_cat_check_content = $array_cat_add_content;
  233. }
  234. foreach ( $catids as $catid_i )
  235. {
  236. if ( ! in_array( $catid_i, $array_cat_check_content ) )
  237. {
  238. $error[] = sprintf( $lang_module['permissions_pub_error'], $global_array_cat[$catid_i]['title'] );
  239. }
  240. }
  241. $rowcontent['topicid'] = $nv_Request->get_int( 'topicid', 'post', 0 );
  242. if ( $rowcontent['topicid'] == 0 )
  243. {
  244. $rowcontent['topictext'] = filter_text_input( 'topictext', 'post', '' );
  245. if ( ! empty( $rowcontent['topictext'] ) )
  246. {
  247. list( $rowcontent['topicid'] ) = $db->sql_fetchrow( $db->sql_query( "SELECT `topicid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_topics` WHERE `title`=" . $db->dbescape( $rowcontent['topictext'] ) . "" ) );
  248. }
  249. }
  250. $rowcontent['author'] = filter_text_input( 'author', 'post', '', 1 );
  251. $rowcontent['sourceid'] = $nv_Request->get_int( 'sourceid', 'post', 0 );
  252. if ( $rowcontent['sourceid'] == 0 )
  253. {
  254. $rowcontent['sourcetext'] = filter_text_input( 'sourcetext', 'post', '' );
  255. if ( ! empty( $rowcontent['sourcetext'] ) )
  256. {
  257. list( $rowcontent['sourceid'] ) = $db->sql_fetchrow( $db->sql_query( "SELECT `sourceid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_sources` WHERE `title`=" . $db->dbescape( $rowcontent['sourcetext'] ) . "" ) );
  258. }
  259. }
  260. if ( intval( $rowcontent['sourceid'] ) > 0 ) $rowcontent['sourcetext'] = "";
  261. $publ_date = filter_text_input( 'publ_date', 'post', '' );
  262. $exp_date = filter_text_input( 'exp_date', 'post', '' );
  263. if ( ! empty( $publ_date ) and ! preg_match( "/^([0-9]{1,2})\\/([0-9]{1,2})\/([0-9]{4})$/", $publ_date ) ) $publ_date = "";
  264. if ( ! empty( $exp_date ) and ! preg_match( "/^([0-9]{1,2})\\/([0-9]{1,2})\/([0-9]{4})$/", $exp_date ) ) $exp_date = "";
  265. if ( empty( $publ_date ) )
  266. {
  267. $rowcontent['publtime'] = NV_CURRENTTIME;
  268. }
  269. else
  270. {
  271. $phour = $nv_Request->get_int( 'phour', 'post', 0 );
  272. $pmin = $nv_Request->get_int( 'pmin', 'post', 0 );
  273. unset( $m );
  274. preg_match( "/^([0-9]{1,2})\\/([0-9]{1,2})\/([0-9]{4})$/", $publ_date, $m );
  275. $rowcontent['publtime'] = mktime( $phour, $pmin, 0, $m[2], $m[1], $m[3] );
  276. }
  277. if ( empty( $exp_date ) )
  278. {
  279. $rowcontent['exptime'] = 0;
  280. }
  281. else
  282. {
  283. $ehour = $nv_Request->get_int( 'ehour', 'post', 0 );
  284. $emin = $nv_Request->get_int( 'emin', 'post', 0 );
  285. unset( $m );
  286. preg_match( "/^([0-9]{1,2})\\/([0-9]{1,2})\/([0-9]{4})$/", $exp_date, $m );
  287. $rowcontent['exptime'] = mktime( $ehour, $emin, 0, $m[2], $m[1], $m[3] );
  288. }
  289. $rowcontent['archive'] = $nv_Request->get_int( 'archive', 'post', 0 );
  290. if ( $rowcontent['archive'] > 0 )
  291. {
  292. $rowcontent['archive'] = ( $rowcontent['exptime'] > NV_CURRENTTIME ) ? 1 : 2;
  293. }
  294. $rowcontent['title'] = filter_text_input( 'title', 'post', '', 1 );
  295. $alias = filter_text_input( 'alias', 'post', '' );
  296. $rowcontent['alias'] = ( $alias == "" ) ? change_alias( $rowcontent['title'] ) : change_alias( $alias );
  297. $rowcontent['hometext'] = filter_text_input( 'hometext', 'post', '' );
  298. $rowcontent['homeimgfile'] = filter_text_input( 'homeimg', 'post', '' );
  299. $rowcontent['homeimgalt'] = filter_text_input( 'homeimgalt', 'post', '', 1 );
  300. $rowcontent['imgposition'] = $nv_Request->get_int( 'imgposition', 'post', 0 );
  301. if ( ! array_key_exists( $rowcontent['imgposition'], $array_imgposition ) )
  302. {
  303. $rowcontent['imgposition'] = 1;
  304. }
  305. $bodytext = $nv_Request->get_string( 'bodytext', 'post', '' );
  306. $rowcontent['bodytext'] = defined( 'NV_EDITOR' ) ? nv_nl2br( $bodytext, '' ) : nv_nl2br( nv_htmlspecialchars( strip_tags( $bodytext ) ), '<br />' );
  307. $sourcetext = filter_text_input( 'sourcetext', 'post', '', 1 );
  308. $rowcontent['copyright'] = ( int )$nv_Request->get_bool( 'copyright', 'post' );
  309. $rowcontent['inhome'] = ( int )$nv_Request->get_bool( 'inhome', 'post' );
  310. $rowcontent['allowed_comm'] = $nv_Request->get_int( 'allowed_comm', 'post', 0 );
  311. $rowcontent['allowed_rating'] = ( int )$nv_Request->get_bool( 'allowed_rating', 'post' );
  312. $rowcontent['allowed_send'] = ( int )$nv_Request->get_bool( 'allowed_send', 'post' );
  313. $rowcontent['allowed_print'] = ( int )$nv_Request->get_bool( 'allowed_print', 'post' );
  314. $rowcontent['allowed_save'] = ( int )$nv_Request->get_bool( 'allowed_save', 'post' );
  315. $rowcontent['keywords'] = filter_text_input( 'keywords', 'post', '', 1 );
  316. if ( empty( $rowcontent['title'] ) )
  317. {
  318. $error[] = $lang_module['error_title'];
  319. }
  320. elseif ( empty( $rowcontent['listcatid'] ) )
  321. {
  322. $error[] = $lang_module['error_cat'];
  323. }
  324. elseif ( trim( strip_tags( $rowcontent['bodytext'] ) ) == "" )
  325. {
  326. $error[] = $lang_module['error_bodytext'];
  327. }
  328. if ( empty( $error ) )
  329. {
  330. if ( ! empty( $rowcontent['topictext'] ) )
  331. {
  332. list( $weightopic ) = $db->sql_fetchrow( $db->sql_query( "SELECT max(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_topics`" ) );
  333. $weightopic = intval( $weightopic ) + 1;
  334. $aliastopic = change_alias( $rowcontent['topictext'] );
  335. $query = "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_topics` (`topicid`, `title`, `alias`, `description`, `image`, `thumbnail`, `weight`, `keywords`, `add_time`, `edit_time`) VALUES (NULL, " . $db->dbescape( $rowcontent['topictext'] ) . ", " . $db->dbescape( $aliastopic ) . ", " . $db->dbescape( $rowcontent['topictext'] ) . ", '', '', " . $db->dbescape( $weightopic ) . ", " . $db->dbescape( $rowcontent['topictext'] ) . ", UNIX_TIMESTAMP( ), UNIX_TIMESTAMP( ))";
  336. $rowcontent['topicid'] = $db->sql_query_insert_id( $query );
  337. }
  338. if ( ! empty( $rowcontent['sourcetext'] ) )
  339. {
  340. list( $weight ) = $db->sql_fetchrow( $db->sql_query( "SELECT max(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_sources`" ) );
  341. $weight = intval( $weight ) + 1;
  342. $query = "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_sources` (`sourceid`, `title`, `link`, `logo`, `weight`, `add_time`, `edit_time`) VALUES (NULL, " . $db->dbescape( $rowcontent['sourcetext'] ) . ", '', '', " . $db->dbescape( $weight ) . ", UNIX_TIMESTAMP( ), UNIX_TIMESTAMP( ))";
  343. $rowcontent['sourceid'] = $db->sql_query_insert_id( $query );
  344. }
  345. if ( $rowcontent['keywords'] == "" )
  346. {
  347. if ( $rowcontent['hometext'] != "" )
  348. {
  349. $rowcontent['keywords'] = nv_content_keywords( $rowcontent['hometext'] );
  350. }
  351. else
  352. {
  353. $rowcontent['keywords'] = nv_content_keywords( $rowcontent['bodytext'] );
  354. }
  355. }
  356. // Xu ly anh minh ha
  357. $rowcontent['homeimgthumb'] = "";
  358. if ( ! nv_is_url( $rowcontent['homeimgfile'] ) and file_exists( NV_DOCUMENT_ROOT . $rowcontent['homeimgfile'] ) )
  359. {
  360. $lu = strlen( NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" );
  361. $rowcontent['homeimgfile'] = substr( $rowcontent['homeimgfile'], $lu );
  362. }
  363. elseif ( ! nv_is_url( $rowcontent['homeimgfile'] ) )
  364. {
  365. $rowcontent['homeimgfile'] = "";
  366. }
  367. $check_thumb = false;
  368. if ( $rowcontent['id'] > 0 )
  369. {
  370. list( $homeimgfile, $homeimgthumb ) = $db->sql_fetchrow( $db->sql_query( "SELECT `homeimgfile`, `homeimgthumb` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $rowcontent['id'] . "" ) );
  371. if ( $rowcontent['homeimgfile'] != $homeimgfile )
  372. {
  373. $check_thumb = true;
  374. if ( $homeimgthumb != "" and $homeimgthumb != "|" )
  375. {
  376. $rowcontent['homeimgthumb'] = "";
  377. $homeimgthumb_arr = explode( "|", $homeimgthumb );
  378. foreach ( $homeimgthumb_arr as $homeimgthumb_i )
  379. {
  380. if ( file_exists( NV_ROOTDIR . '/' . NV_FILES_DIR . "/" . $module_name . "/" . $homeimgthumb_i ) )
  381. {
  382. nv_deletefile( NV_ROOTDIR . '/' . NV_FILES_DIR . "/" . $module_name . "/" . $homeimgthumb_i );
  383. }
  384. }
  385. }
  386. }
  387. else
  388. {
  389. $rowcontent['homeimgthumb'] = $homeimgthumb;
  390. }
  391. }
  392. elseif ( ! empty( $rowcontent['homeimgfile'] ) )
  393. {
  394. $check_thumb = true;
  395. }
  396. $homeimgfile = NV_UPLOADS_REAL_DIR . "/" . $module_name . "/" . $rowcontent['homeimgfile'];
  397. if ( $check_thumb and file_exists( $homeimgfile ) )
  398. {
  399. require_once ( NV_ROOTDIR . "/includes/class/image.class.php" );
  400. $basename = basename( $homeimgfile );
  401. $image = new image( $homeimgfile, NV_MAX_WIDTH, NV_MAX_HEIGHT );
  402. $thumb_basename = $basename;
  403. $i = 1;
  404. while ( file_exists( NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/thumb/' . $thumb_basename ) )
  405. {
  406. $thumb_basename = preg_replace( '/(.*)(\.[a-zA-Z]+)$/', '\1_' . $i . '\2', $basename );
  407. $i ++;
  408. }
  409. $image->resizeXY( $module_config[$module_name]['homewidth'], $module_config[$module_name]['homeheight'] );
  410. $image->save( NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/thumb', $thumb_basename );
  411. $image_info = $image->create_Image_info;
  412. $thumb_name = str_replace( NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/', '', $image_info['src'] );
  413. $block_basename = $basename;
  414. $i = 1;
  415. while ( file_exists( NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/block/' . $block_basename ) )
  416. {
  417. $block_basename = preg_replace( '/(.*)(\.[a-zA-Z]+)$/', '\1_' . $i . '\2', $basename );
  418. $i ++;
  419. }
  420. $image->resizeXY( $module_config[$module_name]['blockwidth'], $module_config[$module_name]['blockheight'] );
  421. $image->save( NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/block', $block_basename );
  422. $image_info = $image->create_Image_info;
  423. $block_name = str_replace( NV_ROOTDIR . '/' . NV_FILES_DIR . '/' . $module_name . '/', '', $image_info['src'] );
  424. $image->close();
  425. $rowcontent['homeimgthumb'] = $thumb_name . "|" . $block_name;
  426. }
  427. if ( $rowcontent['id'] == 0 )
  428. {
  429. $rowcontent['publtime'] = ( $rowcontent['publtime'] > NV_CURRENTTIME ) ? $rowcontent['publtime'] : NV_CURRENTTIME;
  430. $query = "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_rows` (`id`, `listcatid`, `topicid`, `admin_id`, `author`, `sourceid`, `addtime`, `edittime`, `status`, `publtime`, `exptime`, `archive`, `title`, `alias`, `hometext`, `homeimgfile`, `homeimgalt`, `homeimgthumb`, `imgposition`, `bodytext`, `copyright`, `inhome`, `allowed_comm`, `allowed_rating`, `allowed_send`, `allowed_print`, `allowed_save`, `hitstotal`, `hitscm`, `total_rating`, `click_rating`, `keywords`) VALUES
  431. (NULL, " . $db->dbescape_string( $rowcontent['listcatid'] ) . ",
  432. " . intval( $rowcontent['topicid'] ) . ",
  433. " . intval( $rowcontent['admin_id'] ) . ",
  434. " . $db->dbescape_string( $rowcontent['author'] ) . ",
  435. " . intval( $rowcontent['sourceid'] ) . ",
  436. " . intval( $rowcontent['addtime'] ) . ",
  437. " . intval( $rowcontent['edittime'] ) . ",
  438. " . intval( $rowcontent['status'] ) . ",
  439. " . intval( $rowcontent['publtime'] ) . ",
  440. " . intval( $rowcontent['exptime'] ) . ",
  441. " . intval( $rowcontent['archive'] ) . ",
  442. " . $db->dbescape_string( $rowcontent['title'] ) . ",
  443. " . $db->dbescape_string( $rowcontent['alias'] ) . ",
  444. " . $db->dbescape_string( $rowcontent['hometext'] ) . ",
  445. " . $db->dbescape_string( $rowcontent['homeimgfile'] ) . ",
  446. " . $db->dbescape_string( $rowcontent['homeimgalt'] ) . ",
  447. " . $db->dbescape_string( $rowcontent['homeimgthumb'] ) . ",
  448. " . intval( $rowcontent['imgposition'] ) . ",
  449. " . $db->dbescape_string( $rowcontent['bodytext'] ) . ",
  450. " . intval( $rowcontent['copyright'] ) . ",
  451. " . intval( $rowcontent['inhome'] ) . ",
  452. " . intval( $rowcontent['allowed_comm'] ) . ",
  453. " . intval( $rowcontent['allowed_rating'] ) . ",
  454. " . intval( $rowcontent['allowed_send'] ) . ",
  455. " . intval( $rowcontent['allowed_print'] ) . ",
  456. " . intval( $rowcontent['allowed_save'] ) . ",
  457. " . intval( $rowcontent['hitstotal'] ) . ",
  458. " . intval( $rowcontent['hitscm'] ) . ",
  459. " . intval( $rowcontent['total_rating'] ) . ",
  460. " . intval( $rowcontent['click_rating'] ) . ",
  461. " . $db->dbescape_string( $rowcontent['keywords'] ) . ")";
  462. $rowcontent['id'] = $db->sql_query_insert_id( $query );
  463. if ( $rowcontent['id'] > 0 )
  464. {
  465. nv_insert_logs( NV_LANG_DATA, $module_name, $lang_module['content_add'], $rowcontent['title'], $admin_info['userid'] );
  466. foreach ( $catids as $catid )
  467. {
  468. $db->sql_query( "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $rowcontent['id'] . "" );
  469. }
  470. }
  471. else
  472. {
  473. $error[] = $lang_module['errorsave'];
  474. }
  475. $db->sql_freeresult();
  476. }
  477. else
  478. {
  479. nv_save_log_content( $rowcontent['id'] );
  480. $rowcontent_old = $db->sql_fetchrow( $db->sql_query( "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` where `id`=" . $rowcontent['id'] . "" ) );
  481. if ( $rowcontent_old['status'] == 1 )
  482. {
  483. $rowcontent['status'] = 1;
  484. }
  485. $query = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET
  486. `listcatid`=" . $db->dbescape_string( $rowcontent['listcatid'] ) . ",
  487. `topicid`=" . intval( $rowcontent['topicid'] ) . ",
  488. `author`=" . $db->dbescape_string( $rowcontent['author'] ) . ",
  489. `sourceid`=" . intval( $rowcontent['sourceid'] ) . ",
  490. `status`=" . intval( $rowcontent['status'] ) . ",
  491. `publtime`=" . intval( $rowcontent['publtime'] ) . ",
  492. `exptime`=" . intval( $rowcontent['exptime'] ) . ",
  493. `archive`=" . intval( $rowcontent['archive'] ) . ",
  494. `title`=" . $db->dbescape_string( $rowcontent['title'] ) . ",
  495. `alias`=" . $db->dbescape_string( $rowcontent['alias'] ) . ",
  496. `hometext`=" . $db->dbescape_string( $rowcontent['hometext'] ) . ",
  497. `homeimgfile`=" . $db->dbescape_string( $rowcontent['homeimgfile'] ) . ",
  498. `homeimgalt`=" . $db->dbescape_string( $rowcontent['homeimgalt'] ) . ",
  499. `homeimgthumb`=" . $db->dbescape_string( $rowcontent['homeimgthumb'] ) . ",
  500. `imgposition`=" . intval( $rowcontent['imgposition'] ) . ",
  501. `bodytext`=" . $db->dbescape_string( $rowcontent['bodytext'] ) . ",
  502. `copyright`=" . intval( $rowcontent['copyright'] ) . ",
  503. `inhome`=" . intval( $rowcontent['inhome'] ) . ",
  504. `allowed_comm`=" . intval( $rowcontent['allowed_comm'] ) . ",
  505. `allowed_rating`=" . intval( $rowcontent['allowed_rating'] ) . ",
  506. `allowed_send`=" . intval( $rowcontent['allowed_send'] ) . ",
  507. `allowed_print`=" . intval( $rowcontent['allowed_print'] ) . ",
  508. `allowed_save`=" . intval( $rowcontent['allowed_save'] ) . ",
  509. `keywords`=" . $db->dbescape_string( $rowcontent['keywords'] ) . ",
  510. `edittime`=UNIX_TIMESTAMP( )
  511. WHERE `id` =" . $rowcontent['id'] . "";
  512. $db->sql_query( $query );
  513. if ( $db->sql_affectedrows() > 0 )
  514. {
  515. nv_insert_logs( NV_LANG_DATA, $module_name, $lang_module['content_edit'], $rowcontent['title'], $admin_info['userid'] );
  516. $array_cat_old = explode( ",", $rowcontent_old['listcatid'] );
  517. foreach ( $array_cat_old as $catid )
  518. {
  519. $db->sql_query( "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE `id` = " . $rowcontent['id'] . "" );
  520. }
  521. $array_cat_new = explode( ",", $rowcontent['listcatid'] );
  522. foreach ( $array_cat_new as $catid )
  523. {
  524. $db->sql_query( "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $rowcontent['id'] . "" );
  525. }
  526. }
  527. else
  528. {
  529. $error[] = $lang_module['errorsave'];
  530. }
  531. $db->sql_freeresult();
  532. }
  533. nv_del_moduleCache( $module_name );
  534. if ( empty( $error ) )
  535. {
  536. if ( $rowcontent['publtime'] > NV_CURRENTTIME or $rowcontent['exptime'] > 0 )
  537. {
  538. $rowcontent['exptime'] = ( $rowcontent['exptime'] > 0 ) ? $rowcontent['exptime'] : NV_CURRENTTIME + 26000000;
  539. $array_cat_new = explode( ",", $rowcontent['listcatid'] );
  540. foreach ( $array_cat_new as $catid )
  541. {
  542. list( $del_cache_time ) = $db->sql_fetchrow( $db->sql_query( "SELECT `del_cache_time` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `catid` =" . $catid . "" ) );
  543. $del_cache_time = min( $rowcontent['publtime'], $rowcontent['exptime'], $del_cache_time );
  544. $db->sql_query( "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_cat` SET `del_cache_time`=" . $db->dbescape( $del_cache_time ) . " WHERE `catid`=" . $catid . "" );
  545. }
  546. }
  547. foreach ( $id_block_content as $bid_i )
  548. {
  549. $db->sql_query( "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_block` (`bid`, `id`, `weight`) VALUES ('" . $bid_i . "', '" . $rowcontent['id'] . "', '0')" );
  550. }
  551. $id_block_content[] = 0;
  552. $db->sql_query( "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block` WHERE `id` = " . $rowcontent['id'] . " AND `bid` NOT IN (" . implode( ",", $id_block_content ) . ")" );
  553. $id_block_content = array_keys( $array_block_cat_module );
  554. foreach ( $id_block_content as $bid_i )
  555. {
  556. nv_news_fix_block( $bid_i, false );
  557. }
  558. $url = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name;
  559. $msg1 = $lang_module['content_saveok'];
  560. $msg2 = $lang_module['content_main'] . " " . $module_info['custom_title'];
  561. redriect( $msg1, $msg2, $url );
  562. }
  563. }
  564. }
  565. if ( ! empty( $rowcontent['bodytext'] ) ) $rowcontent['bodytext'] = nv_htmlspecialchars( $rowcontent['bodytext'] );
  566. if ( ! empty( $rowcontent['homeimgfile'] ) and file_exists( NV_UPLOADS_REAL_DIR . "/" . $module_name . "/" . $rowcontent['homeimgfile'] ) )
  567. {
  568. $rowcontent['homeimgfile'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" . $rowcontent['homeimgfile'];
  569. }
  570. $array_catid_in_row = explode( ",", $rowcontent['listcatid'] );
  571. $sql = "SELECT topicid, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_topics` ORDER BY `weight` ASC";
  572. $result = $db->sql_query( $sql );
  573. $array_topic_module = array();
  574. $array_topic_module[0] = $lang_module['topic_sl'];
  575. while ( list( $topicid_i, $title_i ) = $db->sql_fetchrow( $result ) )
  576. {
  577. $array_topic_module[$topicid_i] = $title_i;
  578. }
  579. $sql = "SELECT sourceid, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_sources` ORDER BY `weight` ASC";
  580. $result = $db->sql_query( $sql );
  581. $array_source_module = array();
  582. $array_source_module[0] = $lang_module['sources_sl'];
  583. while ( list( $sourceid_i, $title_i ) = $db->sql_fetchrow( $result ) )
  584. {
  585. $array_source_module[$sourceid_i] = $title_i;
  586. }
  587. $tdate = date( "H|i", $rowcontent['publtime'] );
  588. $publ_date = date( "d/m/Y", $rowcontent['publtime'] );
  589. list( $phour, $pmin ) = explode( "|", $tdate );
  590. if ( $rowcontent['exptime'] == 0 )
  591. {
  592. $emin = $ehour = 0;
  593. $exp_date = "";
  594. }
  595. else
  596. {
  597. $exp_date = date( "d/m/Y", $rowcontent['exptime'] );
  598. $tdate = date( "H|i", $rowcontent['exptime'] );
  599. list( $ehour, $emin ) = explode( "|", $tdate );
  600. }
  601. if ( $rowcontent['status'] and $rowcontent['publtime'] > NV_CURRENTTIME )
  602. {
  603. $array_cat_check_content = $array_cat_pub_content;
  604. }
  605. elseif ( $rowcontent['status'] )
  606. {
  607. $array_cat_check_content = $array_cat_edit_content;
  608. }
  609. else
  610. {
  611. $array_cat_check_content = $array_cat_add_content;
  612. }
  613. if ( empty( $array_cat_check_content ) )
  614. {
  615. Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=cat" );
  616. die();
  617. }
  618. $contents = "";
  619. $my_head = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "js/jquery/jquery.autocomplete.css\" />\n";
  620. $my_head .= "<link type=\"text/css\" href=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.core.css\" rel=\"stylesheet\" />\n";
  621. $my_head .= "<link type=\"text/css\" href=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.theme.css\" rel=\"stylesheet\" />\n";
  622. $my_head .= "<link type=\"text/css\" href=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.datepicker.css\" rel=\"stylesheet\" />\n";
  623. $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.autocomplete.js\"></script>\n";
  624. $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.core.min.js\"></script>\n";
  625. $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/ui/jquery.ui.datepicker.min.js\"></script>\n";
  626. $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/language/jquery.ui.datepicker-" . NV_LANG_INTERFACE . ".js\"></script>\n";
  627. /////////////////////////////////////////////////////////////////////////////////////////////////
  628. $xtpl = new XTemplate( "content.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_file );
  629. $xtpl->assign( 'LANG', $lang_module );
  630. $xtpl->assign( 'rowcontent', $rowcontent );
  631. $xtpl->assign( 'NV_BASE_ADMINURL', NV_BASE_ADMINURL );
  632. $xtpl->assign( 'NV_NAME_VARIABLE', NV_NAME_VARIABLE );
  633. $xtpl->assign( 'NV_OP_VARIABLE', NV_OP_VARIABLE );
  634. $xtpl->assign( 'module_name', $module_name );
  635. $temp = "";
  636. foreach ( $global_array_cat as $catid_i => $array_value )
  637. {
  638. if ( defined( 'NV_IS_ADMIN_MODULE' ) )
  639. {
  640. $check_show = 1;
  641. }
  642. else
  643. {
  644. $array_cat = GetCatidInParent( $catid_i );
  645. $check_show = array_intersect( $array_cat, $array_cat_check_content );
  646. }
  647. if ( ! empty( $check_show ) )
  648. {
  649. $lev_i = $array_value['lev'];
  650. $xtitle_i = "";
  651. if ( $lev_i > 0 )
  652. {
  653. for ( $i = 1; $i <= $lev_i; $i ++ )
  654. {
  655. $xtitle_i .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  656. }
  657. }
  658. $ch = "";
  659. if ( ! in_array( $catid_i, $array_cat_check_content ) )
  660. {
  661. $ch .= " disabled=\"disabled\"";
  662. }
  663. if ( in_array( $catid_i, $array_catid_in_row ) )
  664. {
  665. $ch .= " checked=\"checked\"";
  666. }
  667. $temp .= "<li>" . $xtitle_i . "<input class=\"news_checkbox\" type=\"checkbox\" name=\"catids[]\" value=\"" . $catid_i . "\"" . $ch . " />" . $array_value['title'] . "</li>";
  668. }
  669. }
  670. $xtpl->assign( 'listcatid', $temp );
  671. // Copyright
  672. $checkcop = ( $rowcontent['copyright'] ) ? " checked=\"checked\"" : "";
  673. $xtpl->assign( 'checkcop', $checkcop );
  674. /// topic
  675. while ( list( $topicid_i, $title_i ) = each( $array_topic_module ) )
  676. {
  677. $sl = ( $topicid_i == $rowcontent['topicid'] ) ? " selected=\"selected\"" : "";
  678. $xtpl->assign( 'topicid', $topicid_i );
  679. $xtpl->assign( 'topic_title', $title_i );
  680. $xtpl->assign( 'sl', $sl );
  681. $xtpl->parse( 'main.rowstopic' );
  682. }
  683. // position images
  684. while ( list( $id_imgposition, $title_imgposition ) = each( $array_imgposition ) )
  685. {
  686. $sl = ( $id_imgposition == $rowcontent['imgposition'] ) ? " selected=\"selected\"" : "";
  687. $xtpl->assign( 'id_imgposition', $id_imgposition );
  688. $xtpl->assign( 'title_imgposition', $title_imgposition );
  689. $xtpl->assign( 'posl', $sl );
  690. $xtpl->parse( 'main.looppos' );
  691. }
  692. ///////////time update////////////
  693. $xtpl->assign( 'publ_date', $publ_date );
  694. $select = "";
  695. for ( $i = 0; $i <= 23; $i ++ )
  696. {
  697. $select .= "<option value=\"" . $i . "\"" . ( ( $i == $phour ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  698. }
  699. $xtpl->assign( 'phour', $select );
  700. $select = "";
  701. for ( $i = 0; $i < 60; $i ++ )
  702. {
  703. $select .= "<option value=\"" . $i . "\"" . ( ( $i == $pmin ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  704. }
  705. $xtpl->assign( 'pmin', $select );
  706. /////////// time exp //////////////////////////////////////////
  707. $xtpl->assign( 'publ_date', $publ_date );
  708. $select = "";
  709. for ( $i = 0; $i <= 23; $i ++ )
  710. {
  711. $select .= "<option value=\"" . $i . "\"" . ( ( $i == $ehour ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  712. }
  713. $xtpl->assign( 'ehour', $select );
  714. $select = "";
  715. for ( $i = 0; $i < 60; $i ++ )
  716. {
  717. $select .= "<option value=\"" . $i . "\"" . ( ( $i == $emin ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  718. }
  719. $xtpl->assign( 'emin', $select );
  720. //////// allowed ////////////////
  721. $select = "";
  722. while ( list( $commid_i, $commid_title_i ) = each( $array_allowed_comm ) )
  723. {
  724. $comm_sl = ( $commid_i == $rowcontent['allowed_comm'] ) ? " selected=\"selected\"" : "";
  725. $select .= "<option value=\"" . $commid_i . "\" " . $comm_sl . ">" . $commid_title_i . "</option>\n";
  726. }
  727. $xtpl->assign( 'allowed_comm', $select );
  728. /////////// source //////////////////////////
  729. $select = "";
  730. while ( list( $sourceid_i, $source_title_i ) = each( $array_source_module ) )
  731. {
  732. $source_sl = ( $sourceid_i == $rowcontent['sourceid'] ) ? " selected=\"selected\"" : "";
  733. $select .= "<option value=\"" . $sourceid_i . "\" " . $source_sl . ">" . $source_title_i . "</option>\n";
  734. }
  735. $xtpl->assign( 'sourceid', $select );
  736. ////////////////////////////////////////////////////////////////////////////////////
  737. if ( defined( 'NV_EDITOR' ) and nv_function_exists( 'nv_aleditor' ) )
  738. {
  739. $edits = nv_aleditor( 'bodytext', '100%', '300px', $rowcontent['bodytext'], $uploads_dir_user, $currentpath );
  740. }
  741. else
  742. {
  743. $edits = "<textarea style=\"width: 100%\" name=\"bodytext\" id=\"bodytext\" cols=\"20\" rows=\"15\">" . $rowcontent['bodytext'] . "</textarea>";
  744. }
  745. ///////////////////////////////////////////////////////////////////////////////////////////
  746. $shtm = "";
  747. if ( count( $array_block_cat_module ) > 0 )
  748. {
  749. foreach ( $array_block_cat_module as $bid_i => $bid_title )
  750. {
  751. $ch = in_array( $bid_i, $id_block_content ) ? " checked=\"checked\"" : "";
  752. $shtm .= "<tr><td><input class=\"news_checkbox\" type=\"checkbox\" name=\"bids[]\" value=\"" . $bid_i . "\"" . $ch . " />" . $bid_title . "</td></tr>\n";
  753. }
  754. $xtpl->assign( 'row_block', $shtm );
  755. $xtpl->parse( 'main.block_cat' );
  756. }
  757. //////////////////////////////////////////////////////////////////
  758. $archive_checked = ( $rowcontent['archive'] ) ? " checked=\"checked\"" : "";
  759. $xtpl->assign( 'archive_checked', $archive_checked );
  760. $inhome_checked = ( $rowcontent['inhome'] ) ? " checked=\"checked\"" : "";
  761. $xtpl->assign( 'inhome_checked', $inhome_checked );
  762. $allowed_rating_checked = ( $rowcontent['allowed_rating'] ) ? " checked=\"checked\"" : "";
  763. $xtpl->assign( 'allowed_rating_checked', $allowed_rating_checked );
  764. $allowed_send_checked = ( $rowcontent['allowed_send'] ) ? " checked=\"checked\"" : "";
  765. $xtpl->assign( 'allowed_send_checked', $allowed_send_checked );
  766. $allowed_print_checked = ( $rowcontent['allowed_print'] ) ? " checked=\"checked\"" : "";
  767. $xtpl->assign( 'allowed_print_checked', $allowed_print_checked );
  768. $allowed_save_checked = ( $rowcontent['allowed_save'] ) ? " checked=\"checked\"" : "";
  769. $xtpl->assign( 'allowed_save_checked', $allowed_save_checked );
  770. ////////////////////////////////////////////////////////////////////////////////
  771. $xtpl->assign( 'edit_bodytext', $edits );
  772. ///////////////////////////////////////////////////////////////////////////////////
  773. if ( $error != "" )
  774. {
  775. $xtpl->assign( 'error', implode( "<br />", $error ) );
  776. $xtpl->parse( 'main.error' );
  777. }
  778. if ( $rowcontent['status'] == 1 and $rowcontent['id'] > 0 )
  779. {
  780. $xtpl->parse( 'main.status' );
  781. }
  782. else
  783. {
  784. $xtpl->parse( 'main.status0' );
  785. }
  786. if ( empty( $rowcontent['alias'] ) )
  787. {
  788. $xtpl->parse( 'main.getalias' );
  789. }
  790. $xtpl->assign( 'UPLOADS_DIR_USER', $uploads_dir_user );
  791. $xtpl->assign( 'UPLOAD_CURRENT', $currentpath );
  792. $xtpl->parse( 'main' );
  793. $contents .= $xtpl->text( 'main' );
  794. include ( NV_ROOTDIR . "/includes/header.php" );
  795. echo nv_admin_theme( $contents );
  796. include ( NV_ROOTDIR . "/includes/footer.php" );
  797. ?>