PageRenderTime 27ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 1ms

/NukeViet3.2/modules/news/admin/content.php

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