PageRenderTime 61ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/01.Source/01.CORE/modules/news/admin/content.php

http://creative-portal.googlecode.com/
PHP | 802 lines | 717 code | 71 blank | 14 comment | 95 complexity | c258d245f844d3bd495e50d28f9eb169 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. //TODO: Check permissions
  14. $cp_permissions = unserialize($nv_Request->get_string('cp_permission', 'session'));
  15. if(empty ($cp_permissions)){
  16. cp_check_permission($nv_Request);
  17. $cp_permissions = unserialize($nv_Request->get_string('cp_permission', 'session'));
  18. }
  19. $can_write = $cp_permissions['can_write'];
  20. $can_publish = $cp_permissions['can_publish'];
  21. $month_dir_module = nv_mkdir( NV_UPLOADS_REAL_DIR . '/' . $module_name, date( "Y_m" ), true );
  22. $array_block_cat_module = array();
  23. $id_block_content = array();
  24. $sql = "SELECT bid, adddefault, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block_cat` ORDER BY `weight` ASC";
  25. $result = $db->sql_query( $sql );
  26. while ( list( $bid_i, $adddefault_i, $title_i ) = $db->sql_fetchrow( $result ) )
  27. {
  28. $array_block_cat_module[$bid_i] = $title_i;
  29. if ( $adddefault_i )
  30. {
  31. $id_block_content[] = $bid_i;
  32. }
  33. }
  34. $catid = $nv_Request->get_int( 'catid', 'get', 0 );
  35. $parentid = $nv_Request->get_int( 'parentid', 'get', 0 );
  36. $array_imgposition = array(
  37. 0 => $lang_module['imgposition_0'], 1 => $lang_module['imgposition_1'], 2 => $lang_module['imgposition_2']
  38. );
  39. $rowcontent = array(
  40. "id" => "", "listcatid" => "" . $catid . "," . $parentid . "", "topicid" => "", "admin_id" => $admin_info['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,"is_notice"=>0, "allowed_comm" => $module_config[$module_name]['setcomm'], "allowed_rating" => 1, "ratingdetail" => "0|0", "allowed_send" => 1, "allowed_print" => 1, "allowed_save" => 1, "hitstotal" => 0, "hitscm" => 0, "hitslm" => 0, "keywords" => ""
  41. );
  42. $rowcontent['sourcetext'] = "";
  43. $rowcontent['topictext'] = "";
  44. $page_title = $lang_module['content_add'];
  45. $error = "";
  46. $groups_list = nv_groups_list();
  47. $rowcontent['id'] = $nv_Request->get_int( 'id', 'get,post', 0 );
  48. if ( $nv_Request->get_int( 'save', 'post' ) == 1 )
  49. {
  50. $catids = array_unique( $nv_Request->get_typed_array( 'catids', 'post', 'int', array() ) );
  51. $id_block_content = array_unique( $nv_Request->get_typed_array( 'bids', 'post', 'int', array() ) );
  52. $rowcontent['listcatid'] = implode( ",", $catids );
  53. $rowcontent['topicid'] = $nv_Request->get_int( 'topicid', 'post', 0 );
  54. //TODO: notice
  55. $rowcontent['is_notice'] = $nv_Request->get_int('is_notice', 'post',0);
  56. if ( $rowcontent['topicid'] == 0 )
  57. {
  58. $rowcontent['topictext'] = filter_text_input( 'topictext', 'post', '' );
  59. if ( ! empty( $rowcontent['topictext'] ) )
  60. {
  61. list( $rowcontent['topicid'] ) = $db->sql_fetchrow( $db->sql_query( "SELECT `topicid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_topics` WHERE `title`=" . $db->dbescape( $rowcontent['topictext'] ) . "" ) );
  62. }
  63. }
  64. $rowcontent['author'] = filter_text_input( 'author', 'post', '', 1 );
  65. $rowcontent['sourceid'] = $nv_Request->get_int( 'sourceid', 'post', 0 );
  66. if ( $rowcontent['sourceid'] == 0 )
  67. {
  68. $rowcontent['sourcetext'] = filter_text_input( 'sourcetext', 'post', '' );
  69. if ( ! empty( $rowcontent['sourcetext'] ) )
  70. {
  71. list( $rowcontent['sourceid'] ) = $db->sql_fetchrow( $db->sql_query( "SELECT `sourceid` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_sources` WHERE `title`=" . $db->dbescape( $rowcontent['sourcetext'] ) . "" ) );
  72. }
  73. }
  74. if ( intval( $rowcontent['sourceid'] ) > 0 ) $rowcontent['sourcetext'] = "";
  75. $publ_date = filter_text_input( 'publ_date', 'post', '' );
  76. $exp_date = filter_text_input( 'exp_date', 'post', '' );
  77. if ( ! empty( $publ_date ) and ! preg_match( "/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/", $publ_date ) ) $publ_date = "";
  78. if ( ! empty( $exp_date ) and ! preg_match( "/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/", $exp_date ) ) $exp_date = "";
  79. if ( empty( $publ_date ) )
  80. {
  81. $rowcontent['publtime'] = NV_CURRENTTIME;
  82. }
  83. else
  84. {
  85. $phour = $nv_Request->get_int( 'phour', 'post', 0 );
  86. $pmin = $nv_Request->get_int( 'pmin', 'post', 0 );
  87. unset( $m );
  88. preg_match( "/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/", $publ_date, $m );
  89. $rowcontent['publtime'] = mktime( $phour, $pmin, 0, $m[2], $m[1], $m[3] );
  90. }
  91. if ( empty( $exp_date ) )
  92. {
  93. $rowcontent['exptime'] = 0;
  94. }
  95. else
  96. {
  97. $ehour = $nv_Request->get_int( 'ehour', 'post', 0 );
  98. $emin = $nv_Request->get_int( 'emin', 'post', 0 );
  99. unset( $m );
  100. preg_match( "/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/", $exp_date, $m );
  101. $rowcontent['exptime'] = mktime( $ehour, $emin, 0, $m[2], $m[1], $m[3] );
  102. }
  103. $rowcontent['archive'] = $nv_Request->get_int( 'archive', 'post', 0 );
  104. if ( $rowcontent['archive'] > 0 )
  105. {
  106. $rowcontent['archive'] = ( $rowcontent['exptime'] > NV_CURRENTTIME ) ? 1 : 2;
  107. }
  108. $rowcontent['title'] = filter_text_input( 'title', 'post', '', 1 );
  109. $alias = filter_text_input( 'alias', 'post', '' );
  110. $rowcontent['alias'] = ( $alias == "" ) ? change_alias( $rowcontent['title'] ) : change_alias( $alias );
  111. $rowcontent['hometext'] = filter_text_input( 'hometext', 'post', '' );
  112. $rowcontent['homeimgfile'] = filter_text_input( 'homeimg', 'post', '' );
  113. $rowcontent['homeimgalt'] = filter_text_input( 'homeimgalt', 'post', '', 1 );
  114. $rowcontent['imgposition'] = $nv_Request->get_int( 'imgposition', 'post', 0 );
  115. if ( ! array_key_exists( $rowcontent['imgposition'], $array_imgposition ) )
  116. {
  117. $rowcontent['imgposition'] = 1;
  118. }
  119. $bodytext = $nv_Request->get_string( 'bodytext', 'post', '' );
  120. $rowcontent['bodytext'] = defined( 'NV_EDITOR' ) ? nv_nl2br( $bodytext, '' ) : nv_nl2br( nv_htmlspecialchars( strip_tags( $bodytext ) ), '<br />' );
  121. $sourcetext = filter_text_input( 'sourcetext', 'post', '', 1 );
  122. $rowcontent['copyright'] = ( int )$nv_Request->get_bool( 'copyright', 'post' );
  123. $rowcontent['inhome'] = ( int )$nv_Request->get_bool( 'inhome', 'post' );
  124. $rowcontent['allowed_comm'] = $nv_Request->get_int( 'allowed_comm', 'post', 0 );
  125. $rowcontent['allowed_rating'] = ( int )$nv_Request->get_bool( 'allowed_rating', 'post' );
  126. $rowcontent['allowed_send'] = ( int )$nv_Request->get_bool( 'allowed_send', 'post' );
  127. $rowcontent['allowed_print'] = ( int )$nv_Request->get_bool( 'allowed_print', 'post' );
  128. $rowcontent['allowed_save'] = ( int )$nv_Request->get_bool( 'allowed_save', 'post' );
  129. $rowcontent['keywords'] = filter_text_input( 'keywords', 'post', '', 1 );
  130. if ( empty( $rowcontent['title'] ) )
  131. {
  132. $error = $lang_module['error_title'];
  133. }
  134. elseif ( empty( $rowcontent['listcatid'] ) )
  135. {
  136. $error = $lang_module['error_cat'];
  137. }
  138. elseif ( trim( strip_tags( $rowcontent['bodytext'] ) ) == "" )
  139. {
  140. $error = $lang_module['error_bodytext'];
  141. }
  142. else
  143. {
  144. if ( ! empty( $rowcontent['topictext'] ) )
  145. {
  146. list( $weightopic ) = $db->sql_fetchrow( $db->sql_query( "SELECT max(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_topics`" ) );
  147. $weightopic = intval( $weightopic ) + 1;
  148. $aliastopic = change_alias( $rowcontent['topictext'] );
  149. $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( ))";
  150. $rowcontent['topicid'] = $db->sql_query_insert_id( $query );
  151. }
  152. if ( ! empty( $rowcontent['sourcetext'] ) )
  153. {
  154. list( $weight ) = $db->sql_fetchrow( $db->sql_query( "SELECT max(`weight`) FROM `" . NV_PREFIXLANG . "_" . $module_data . "_sources`" ) );
  155. $weight = intval( $weight ) + 1;
  156. $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( ))";
  157. $rowcontent['sourceid'] = $db->sql_query_insert_id( $query );
  158. }
  159. if ( $rowcontent['keywords'] == "" )
  160. {
  161. if ( $rowcontent['hometext'] != "" )
  162. {
  163. $rowcontent['keywords'] = nv_content_keywords( $rowcontent['hometext'] );
  164. }
  165. else
  166. {
  167. $rowcontent['keywords'] = nv_content_keywords( $rowcontent['bodytext'] );
  168. }
  169. }
  170. $rowcontent['status'] = ( $nv_Request->isset_request( 'status1', 'post' ) ) ? 1 : 0;
  171. // Xu ly anh minh ha
  172. $rowcontent['homeimgthumb'] = "";
  173. if ( ! nv_is_url( $rowcontent['homeimgfile'] ) and file_exists( NV_DOCUMENT_ROOT . $rowcontent['homeimgfile'] ) )
  174. {
  175. $lu = strlen( NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" );
  176. $rowcontent['homeimgfile'] = substr( $rowcontent['homeimgfile'], $lu );
  177. }
  178. elseif ( ! nv_is_url( $rowcontent['homeimgfile'] ) )
  179. {
  180. $rowcontent['homeimgfile'] = "";
  181. }
  182. $check_thumb = false;
  183. if ( $rowcontent['id'] > 0 )
  184. {
  185. list( $homeimgfile, $homeimgthumb ) = $db->sql_fetchrow( $db->sql_query( "SELECT `homeimgfile`, `homeimgthumb` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $rowcontent['id'] . "" ) );
  186. if ( $rowcontent['homeimgfile'] != $homeimgfile )
  187. {
  188. $check_thumb = true;
  189. if ( $homeimgthumb != "" and $homeimgthumb != "|" )
  190. {
  191. $rowcontent['homeimgthumb'] = "";
  192. $homeimgthumb_arr = explode( "|", $homeimgthumb );
  193. foreach ( $homeimgthumb_arr as $homeimgthumb_i )
  194. {
  195. if ( file_exists( NV_UPLOADS_REAL_DIR . "/" . $module_name . "/" . $homeimgthumb_i ) )
  196. {
  197. nv_deletefile( NV_UPLOADS_REAL_DIR . "/" . $module_name . "/" . $homeimgthumb_i );
  198. }
  199. }
  200. }
  201. }
  202. else
  203. {
  204. $rowcontent['homeimgthumb'] = $homeimgthumb;
  205. }
  206. }
  207. elseif ( ! empty( $rowcontent['homeimgfile'] ) )
  208. {
  209. $check_thumb = true;
  210. }
  211. $homeimgfile = NV_UPLOADS_REAL_DIR . "/" . $module_name . "/" . $rowcontent['homeimgfile'];
  212. if ( $check_thumb and file_exists( $homeimgfile ) )
  213. {
  214. require_once ( NV_ROOTDIR . "/includes/class/image.class.php" );
  215. $basename = basename( $homeimgfile );
  216. $image = new image( $homeimgfile, NV_MAX_WIDTH, NV_MAX_HEIGHT );
  217. $thumb_basename = $basename;
  218. $i = 1;
  219. while ( file_exists( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb/' . $thumb_basename ) )
  220. {
  221. $thumb_basename = preg_replace( '/(.*)(\.[a-zA-Z]+)$/', '\1_' . $i . '\2', $basename );
  222. $i ++;
  223. }
  224. $image->resizeXY( $module_config[$module_name]['homewidth'], $module_config[$module_name]['homeheight'] );
  225. $image->save( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/thumb', $thumb_basename );
  226. $image_info = $image->create_Image_info;
  227. $thumb_name = str_replace( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/', '', $image_info['src'] );
  228. $block_basename = $basename;
  229. $i = 1;
  230. while ( file_exists( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/block/' . $block_basename ) )
  231. {
  232. $block_basename = preg_replace( '/(.*)(\.[a-zA-Z]+)$/', '\1_' . $i . '\2', $basename );
  233. $i ++;
  234. }
  235. $image->resizeXY( $module_config[$module_name]['blockwidth'], $module_config[$module_name]['blockheight'] );
  236. $image->save( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/block', $block_basename );
  237. $image_info = $image->create_Image_info;
  238. $block_name = str_replace( NV_UPLOADS_REAL_DIR . '/' . $module_name . '/', '', $image_info['src'] );
  239. $image->close();
  240. $rowcontent['homeimgthumb'] = $thumb_name . "|" . $block_name;
  241. }
  242. if ( $rowcontent['id'] == 0 )
  243. {
  244. $rowcontent['publtime'] = ( $rowcontent['publtime'] > NV_CURRENTTIME ) ? $rowcontent['publtime'] : NV_CURRENTTIME;
  245. $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`,`is_notice`, `allowed_comm`, `allowed_rating`, `ratingdetail`, `allowed_send`, `allowed_print`, `allowed_save`, `hitstotal`, `hitscm`, `hitslm`, `keywords`) VALUES
  246. (NULL, " . $db->dbescape_string( $rowcontent['listcatid'] ) . ",
  247. " . intval( $rowcontent['topicid'] ) . ",
  248. " . intval( $rowcontent['admin_id'] ) . ",
  249. " . $db->dbescape_string( $rowcontent['author'] ) . ",
  250. " . intval( $rowcontent['sourceid'] ) . ",
  251. " . intval( $rowcontent['addtime'] ) . ",
  252. " . intval( $rowcontent['edittime'] ) . ",
  253. " . intval( $rowcontent['status'] ) . ",
  254. " . intval( $rowcontent['publtime'] ) . ",
  255. " . intval( $rowcontent['exptime'] ) . ",
  256. " . intval( $rowcontent['archive'] ) . ",
  257. " . $db->dbescape_string( $rowcontent['title'] ) . ",
  258. " . $db->dbescape_string( $rowcontent['alias'] ) . ",
  259. " . $db->dbescape_string( $rowcontent['hometext'] ) . ",
  260. " . $db->dbescape_string( $rowcontent['homeimgfile'] ) . ",
  261. " . $db->dbescape_string( $rowcontent['homeimgalt'] ) . ",
  262. " . $db->dbescape_string( $rowcontent['homeimgthumb'] ) . ",
  263. " . intval( $rowcontent['imgposition'] ) . ",
  264. " . $db->dbescape_string( $rowcontent['bodytext'] ) . ",
  265. " . intval( $rowcontent['copyright'] ) . ",
  266. " . intval( $rowcontent['inhome'] ) . ",
  267. " . intval( $rowcontent['is_notice'] ) . ",
  268. " . intval( $rowcontent['allowed_comm'] ) . ",
  269. " . intval( $rowcontent['allowed_rating'] ) . ",
  270. " . $db->dbescape_string( $rowcontent['ratingdetail'] ) . ",
  271. " . intval( $rowcontent['allowed_send'] ) . ",
  272. " . intval( $rowcontent['allowed_print'] ) . ",
  273. " . intval( $rowcontent['allowed_save'] ) . ",
  274. " . intval( $rowcontent['hitstotal'] ) . ",
  275. " . intval( $rowcontent['hitscm'] ) . ",
  276. " . intval( $rowcontent['hitslm'] ) . ",
  277. " . $db->dbescape_string( $rowcontent['keywords'] ) . ")";
  278. $rowcontent['id'] = $db->sql_query_insert_id( $query );
  279. if ( $rowcontent['id'] > 0 )
  280. {
  281. nv_insert_logs( NV_LANG_DATA, $module_name, 'log_add_content', "id ".$rowcontent['id'], $admin_info['userid'] );
  282. foreach ( $catids as $catid )
  283. {
  284. $db->sql_query( "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $rowcontent['id'] . "" );
  285. }
  286. }
  287. else
  288. {
  289. $error = $lang_module['errorsave'];
  290. }
  291. $db->sql_freeresult();
  292. }
  293. else
  294. {
  295. nv_save_log_content( $rowcontent['id'] );
  296. $rowcontent_old = $db->sql_fetchrow( $db->sql_query( "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` where `id`=" . $rowcontent['id'] . "" ) );
  297. if ( $rowcontent_old['status'] == 1 )
  298. {
  299. $rowcontent['status'] = 1;
  300. }
  301. $query = "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_rows` SET
  302. `listcatid`=" . $db->dbescape_string( $rowcontent['listcatid'] ) . ",
  303. `topicid`=" . intval( $rowcontent['topicid'] ) . ",
  304. `author`=" . $db->dbescape_string( $rowcontent['author'] ) . ",
  305. `sourceid`=" . intval( $rowcontent['sourceid'] ) . ",
  306. `status`=" . intval( $rowcontent['status'] ) . ",
  307. `publtime`=" . intval( $rowcontent['publtime'] ) . ",
  308. `exptime`=" . intval( $rowcontent['exptime'] ) . ",
  309. `archive`=" . intval( $rowcontent['archive'] ) . ",
  310. `title`=" . $db->dbescape_string( $rowcontent['title'] ) . ",
  311. `alias`=" . $db->dbescape_string( $rowcontent['alias'] ) . ",
  312. `hometext`=" . $db->dbescape_string( $rowcontent['hometext'] ) . ",
  313. `homeimgfile`=" . $db->dbescape_string( $rowcontent['homeimgfile'] ) . ",
  314. `homeimgalt`=" . $db->dbescape_string( $rowcontent['homeimgalt'] ) . ",
  315. `homeimgthumb`=" . $db->dbescape_string( $rowcontent['homeimgthumb'] ) . ",
  316. `imgposition`=" . intval( $rowcontent['imgposition'] ) . ",
  317. `bodytext`=" . $db->dbescape_string( $rowcontent['bodytext'] ) . ",
  318. `copyright`=" . intval( $rowcontent['copyright'] ) . ",
  319. `inhome`=" . intval( $rowcontent['inhome'] ) . ",
  320. `is_notice`=" . intval( $rowcontent['is_notice'] ) . ",
  321. `allowed_comm`=" . intval( $rowcontent['allowed_comm'] ) . ",
  322. `allowed_rating`=" . intval( $rowcontent['allowed_rating'] ) . ",
  323. `allowed_send`=" . intval( $rowcontent['allowed_send'] ) . ",
  324. `allowed_print`=" . intval( $rowcontent['allowed_print'] ) . ",
  325. `allowed_save`=" . intval( $rowcontent['allowed_save'] ) . ",
  326. `keywords`=" . $db->dbescape_string( $rowcontent['keywords'] ) . ",
  327. `edittime`=UNIX_TIMESTAMP( )
  328. WHERE `id` =" . $rowcontent['id'] . "";
  329. $db->sql_query( $query );
  330. if ( $db->sql_affectedrows() > 0 )
  331. {
  332. //nv_insert_logs( NV_LANG_DATA, $module_name, 'log_edit_content', "id ".$rowcontent['id'], $admin_info['userid'] );
  333. $array_cat_old = explode( ",", $rowcontent_old['listcatid'] );
  334. foreach ( $array_cat_old as $catid )
  335. {
  336. $db->sql_query( "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` WHERE `id` = " . $rowcontent['id'] . "" );
  337. }
  338. $array_cat_new = explode( ",", $rowcontent['listcatid'] );
  339. foreach ( $array_cat_new as $catid )
  340. {
  341. $db->sql_query( "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_" . $catid . "` SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` WHERE `id`=" . $rowcontent['id'] . "" );
  342. }
  343. }
  344. else
  345. {
  346. $error = $lang_module['errorsave'];
  347. }
  348. $db->sql_freeresult();
  349. }
  350. nv_del_moduleCache( $module_name );
  351. if ( $error == "" )
  352. {
  353. if ( $rowcontent['publtime'] > NV_CURRENTTIME or $rowcontent['exptime'] > 0 )
  354. {
  355. $rowcontent['exptime'] = ( $rowcontent['exptime'] > 0 ) ? $rowcontent['exptime'] : NV_CURRENTTIME + 26000000;
  356. $array_cat_new = explode( ",", $rowcontent['listcatid'] );
  357. foreach ( $array_cat_new as $catid )
  358. {
  359. list( $del_cache_time ) = $db->sql_fetchrow( $db->sql_query( "SELECT `del_cache_time` FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` WHERE `catid` =" . $catid . "" ) );
  360. $del_cache_time = min( $rowcontent['publtime'], $rowcontent['exptime'], $del_cache_time );
  361. $db->sql_query( "UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "_cat` SET `del_cache_time`=" . $db->dbescape( $del_cache_time ) . " WHERE `catid`=" . $catid . "" );
  362. }
  363. }
  364. foreach ( $id_block_content as $bid_i )
  365. {
  366. $db->sql_query( "INSERT INTO `" . NV_PREFIXLANG . "_" . $module_data . "_block` (`bid`, `id`, `weight`) VALUES ('" . $bid_i . "', '" . $rowcontent['id'] . "', '0')" );
  367. }
  368. $id_block_content[] = 0;
  369. $db->sql_query( "DELETE FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block` WHERE `id` = " . $rowcontent['id'] . " AND `bid` NOT IN (" . implode( ",", $id_block_content ) . ")" );
  370. $id_block_content = array_keys( $array_block_cat_module );
  371. foreach ( $id_block_content as $bid_i )
  372. {
  373. nv_news_fix_block( $bid_i, false );
  374. }
  375. Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "" );
  376. die();
  377. }
  378. }
  379. }
  380. elseif ( $rowcontent['id'] > 0 )
  381. {
  382. $rowcontent = $db->sql_fetchrow( $db->sql_query( "SELECT * FROM `" . NV_PREFIXLANG . "_" . $module_data . "_rows` where `id`=" . $rowcontent['id'] . "" ) );
  383. if ( empty( $rowcontent['id'] ) )
  384. {
  385. Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "" );
  386. die();
  387. }
  388. $page_title = $lang_module['content_edit'];
  389. $rowcontent['sourcetext'] = "";
  390. $rowcontent['topictext'] = "";
  391. $id_block_content = array();
  392. $sql = "SELECT bid FROM `" . NV_PREFIXLANG . "_" . $module_data . "_block` where `id`='" . $rowcontent['id'] . "' ";
  393. $result = $db->sql_query( $sql );
  394. while ( list( $bid_i ) = $db->sql_fetchrow( $result ) )
  395. {
  396. $id_block_content[] = $bid_i;
  397. }
  398. }
  399. if ( ! empty( $rowcontent['bodytext'] ) ) $rowcontent['bodytext'] = nv_htmlspecialchars( $rowcontent['bodytext'] );
  400. if ( ! empty( $rowcontent['homeimgfile'] ) and file_exists( NV_UPLOADS_REAL_DIR . "/" . $module_name . "/" . $rowcontent['homeimgfile'] ) )
  401. {
  402. $rowcontent['homeimgfile'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name . "/" . $rowcontent['homeimgfile'];
  403. }
  404. $array_catid_in_row = explode( ",", $rowcontent['listcatid'] );
  405. $sql = "SELECT topicid, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_topics` ORDER BY `weight` ASC";
  406. $result = $db->sql_query( $sql );
  407. $array_topic_module = array();
  408. $array_topic_module[0] = $lang_module['topic_sl'];
  409. while ( list( $topicid_i, $title_i ) = $db->sql_fetchrow( $result ) )
  410. {
  411. $array_topic_module[$topicid_i] = $title_i;
  412. }
  413. $sql = "SELECT sourceid, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_sources` ORDER BY `weight` ASC";
  414. $result = $db->sql_query( $sql );
  415. $array_source_module = array();
  416. $array_source_module[0] = $lang_module['sources_sl'];
  417. while ( list( $sourceid_i, $title_i ) = $db->sql_fetchrow( $result ) )
  418. {
  419. $array_source_module[$sourceid_i] = $title_i;
  420. }
  421. $tdate = date( "H|i", $rowcontent['publtime'] );
  422. $publ_date = date( "d.m.Y", $rowcontent['publtime'] );
  423. list( $phour, $pmin ) = explode( "|", $tdate );
  424. if ( $rowcontent['exptime'] == 0 )
  425. {
  426. $emin = $ehour = 0;
  427. $exp_date = "";
  428. }
  429. else
  430. {
  431. $exp_date = date( "d.m.Y", $rowcontent['exptime'] );
  432. $tdate = date( "H|i", $rowcontent['exptime'] );
  433. list( $ehour, $emin ) = explode( "|", $tdate );
  434. }
  435. $contents = "";
  436. if ( $error != "" )
  437. {
  438. $contents .= "<div class=\"quote\" style=\"width:780px;\">\n";
  439. $contents .= "<blockquote class=\"error\"><span>" . $error . "</span></blockquote>\n";
  440. $contents .= "</div>\n";
  441. $contents .= "<div class=\"clear\"></div>\n";
  442. }
  443. $my_head = "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . NV_BASE_SITEURL . "js/jquery/jquery.autocomplete.css\" />\n";
  444. $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/jquery/jquery.autocomplete.js\"></script>\n";
  445. $my_head .= "<script type=\"text/javascript\" src=\"" . NV_BASE_SITEURL . "js/popcalendar/popcalendar.js\"></script>\n";
  446. $contents .= "<form action=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op . "&id=" . $rowcontent['id'] . "\" enctype=\"multipart/form-data\" method=\"post\">";
  447. $contents .= "<input type=\"hidden\" name =\"" . NV_NAME_VARIABLE . "\"value=\"" . $module_name . "\" />";
  448. $contents .= "<input type=\"hidden\" name =\"" . NV_OP_VARIABLE . "\"value=\"" . $op . "\" />";
  449. $contents .= "<input type=\"hidden\" value=\"1\" name=\"save\">\n";
  450. $contents .= "<input type=\"hidden\" value=\"" . $rowcontent['id'] . "\" name=\"id\">\n";
  451. $contents .= "<table summary=\"\" class=\"tab2\">\n";
  452. $contents .= "<tr>";
  453. $contents .= "<td valign=\"top\">";
  454. $contents .= " <div class=\"news\"><label><strong>" . $lang_module['name'] . "</strong></label>\n";
  455. $contents .= " <input type=\"text\" maxlength=\"255\" value=\"" . $rowcontent['title'] . "\" name=\"title\" />";
  456. $contents .= " </div>\n";
  457. if ( $rowcontent['alias'] != "" )
  458. {
  459. $contents .= "<div class=\"news\"><label><strong><strong>" . $lang_module['alias'] . ": </strong></label>\n";
  460. $contents .= " <input style=\"width: 380px\" name=\"alias\" type=\"text\" value=\"" . $rowcontent['alias'] . "\" maxlength=\"255\" />";
  461. $contents .= "</div>\n";
  462. }
  463. $contents .= "<div class=\"news\"><label><strong>" . $lang_module['content_cat'] . "</strong></label>\n";
  464. $contents .= " <div style=\"height: 130px; width: 380px; overflow: auto; text-align:left;\">";
  465. $contents .= " <table>\n";
  466. $sql = "SELECT catid, title, lev FROM `" . NV_PREFIXLANG . "_" . $module_data . "_cat` ORDER BY `order` ASC";
  467. $result_cat = $db->sql_query( $sql );
  468. if ( $db->sql_numrows( $result_cat ) == 0 )
  469. {
  470. Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=cat" );
  471. die();
  472. }
  473. while ( list( $catid_i, $title_i, $lev_i ) = $db->sql_fetchrow( $result_cat ) )
  474. {
  475. $xtitle_i = "";
  476. if ( $lev_i > 0 )
  477. {
  478. for ( $i = 1; $i <= $lev_i; $i ++ )
  479. {
  480. $xtitle_i .= "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
  481. }
  482. }
  483. $ch = "";
  484. if ( in_array( $catid_i, $array_catid_in_row ) )
  485. {
  486. $ch = " checked=\"checked\"";
  487. }
  488. $contents .= "<tr><td>" . $xtitle_i . "<input class=\"news_checkbox\" type=\"checkbox\" name=\"catids[]\" value=\"" . $catid_i . "\"" . $ch . ">" . $title_i . "</td></tr>";
  489. }
  490. $contents .= " </table>\n";
  491. $contents .= " </div>\n";
  492. $contents .= "</div>\n";
  493. $contents .= "<div class=\"news\"><label><strong>" . $lang_module['content_topic'] . "</strong></label>\n";
  494. $contents .= "<select name=\"topicid\" style=\"width: 370px;\">\n";
  495. while ( list( $topicid_i, $title_i ) = each( $array_topic_module ) )
  496. {
  497. $sl = "";
  498. if ( $topicid_i == $rowcontent['topicid'] )
  499. {
  500. $sl = " selected=\"selected\"";
  501. }
  502. $contents .= "<option value=\"" . $topicid_i . "\" " . $sl . ">" . $title_i . "</option>\n";
  503. }
  504. $contents .= "</select>";
  505. $contents .= "<br><input type=\"text\" maxlength=\"255\" id=\"AjaxTopicText\" value=\"" . $rowcontent['topictext'] . "\" name=\"topictext\" style=\"width: 370px;\">";
  506. $contents .= "</div>\n";
  507. $contents .= "<div class=\"news\"><label><strong>" . $lang_module['content_homeimg'] . "</strong></label>\n";
  508. $contents .= '<input style="width:260px" type="text" name="homeimg" id="homeimg" value="' . $rowcontent['homeimgfile'] . '"/> ';
  509. $contents .= '<input style="width:100px" type="button" value="' . $lang_global['browse_image'] . '" name="selectimg"/>';
  510. $contents .= "</div>\n";
  511. $contents .= "<div class=\"news\"><label><strong>" . $lang_module['content_homeimgalt'] . "</strong></label>\n";
  512. $contents .= "<input type=\"text\" maxlength=\"255\" value=\"" . $rowcontent['homeimgalt'] . "\" name=\"homeimgalt\" /></div>\n";
  513. $contents .= "<div style=\"clear:both;\"></div>\n";
  514. $contents .= "<div class=\"news\"><label><strong>" . $lang_module['imgposition'] . "</strong></label>\n";
  515. $contents .= " <select name=\"imgposition\">\n";
  516. while ( list( $id_imgposition, $title_imgposition ) = each( $array_imgposition ) )
  517. {
  518. $sl = "";
  519. if ( $id_imgposition == $rowcontent['imgposition'] )
  520. {
  521. $sl = " selected=\"selected\"";
  522. }
  523. $contents .= "<option value=\"" . $id_imgposition . "\" " . $sl . ">" . $title_imgposition . "</option>\n";
  524. }
  525. $contents .= "</select></div><br>\n";
  526. $contents .= "<div style=\"margin-bottom: 1em;\"><label><strong>" . $lang_module['content_hometext'] . "</strong> " . $lang_module['content_notehome'] . "</label><br>\n";
  527. $contents .= "<textarea class=\"textareas\" rows=\"6\" cols=\"20\" name=\"hometext\" style=\"width: 530px;\">" . $rowcontent['hometext'] . "</textarea></div>\n";
  528. $contents .= "</td>";
  529. $contents .= "<td style=\"width:20px;\" >";
  530. $contents .= "</td>";
  531. //TODO: Permissions
  532. if($can_publish){
  533. $contents .= "<td valign=\"top\">";
  534. // BEGIN
  535. $contents .= "<ol class=\"message_list\">\n";
  536. $contents .= "<li>\n";
  537. // TODO: Notice
  538. if($rowcontent['is_notice'] == 1){
  539. $contents .= "<input class=\"news_checkbox\" type=\"checkbox\" name=\"is_notice\" checked='checked' value='1'>";
  540. }
  541. else{
  542. $contents .= "<input class=\"news_checkbox\" type=\"checkbox\" name=\"is_notice\" value='1'>";
  543. }
  544. $contents .= "<label><strong>". $lang_module['is_notice']."</strong></label><br>";
  545. $contents .= "</li>\n";
  546. if ( count( $array_block_cat_module ) > 0 )
  547. {
  548. $contents .= " <li>\n";
  549. $contents .= " <p class=\"message_head\"><cite>" . $lang_module['content_block'] . ":</cite> <span class=\"timestamp\"></span></p>\n";
  550. $contents .= " <div class=\"message_body\">\n";
  551. $contents .= " <div style=\"width: 260px; overflow: auto; text-align:left;\">";
  552. $contents .= " <table>\n";
  553. foreach ( $array_block_cat_module as $bid_i => $bid_title )
  554. {
  555. $ch = in_array( $bid_i, $id_block_content ) ? " checked=\"checked\"" : "";
  556. $contents .= " <tr><td><input class=\"news_checkbox\" type=\"checkbox\" name=\"bids[]\" value=\"" . $bid_i . "\"" . $ch . ">" . $bid_title . "</td></tr>";
  557. }
  558. $contents .= " </table>\n";
  559. $contents .= " </div>\n";
  560. $contents .= " </div>\n";
  561. $contents .= " </li>\n";
  562. }
  563. $contents .= " <li>\n";
  564. $contents .= " <p class=\"message_head\"><cite>" . $lang_module['content_keywords'] . ":</cite> <span class=\"timestamp\"></span></p>\n";
  565. $contents .= " <div class=\"message_body\">\n";
  566. $contents .= " <p>" . $lang_module['content_keywords_note'] . " <a onclick=\"create_keywords();\" href=\"javascript:void(0);\">" . $lang_module['content_clickhere'] . "</a></p>\n";
  567. $contents .= " <textarea rows=\"3\" cols=\"20\" id=\"keywords\" name=\"keywords\" style=\"width: 250px;\">" . $rowcontent['keywords'] . "</textarea>\n";
  568. $contents .= " </div>\n";
  569. $contents .= " </li>\n";
  570. $contents .= "<li>\n";
  571. $contents .= "<p class=\"message_head\"><cite>" . $lang_module['content_publ_date'] . "</cite> <span class=\"timestamp\">" . $lang_module['content_notetime'] . "</span></p>\n";
  572. $contents .= "<div class=\"message_body\"><center>\n";
  573. $contents .= "<input name=\"publ_date\" id=\"publ_date\" value=\"" . $publ_date . "\" style=\"width: 90px;\" maxlength=\"10\" readonly=\"readonly\" type=\"text\">\n";
  574. $contents .= "<img src=\"" . NV_BASE_SITEURL . "images/calendar.jpg\" widht=\"18\" style=\"cursor: pointer; vertical-align: middle;\" onclick=\"popCalendar.show(this, 'publ_date', 'dd.mm.yyyy', false);\" alt=\"\" height=\"17\">\n";
  575. $contents .= "<select name=\"phour\">\n";
  576. for ( $i = 0; $i < 24; $i ++ )
  577. {
  578. $contents .= "<option value=\"" . $i . "\"" . ( ( $i == $phour ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  579. }
  580. $contents .= "</select>:<select name=\"pmin\">\n";
  581. for ( $i = 0; $i < 60; $i ++ )
  582. {
  583. $contents .= "<option value=\"" . $i . "\"" . ( ( $i == $pmin ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  584. }
  585. $contents .= "</select>\n";
  586. $contents .= "</center></div>\n";
  587. $contents .= "</li>\n";
  588. $contents .= "<li>\n";
  589. $contents .= "<p class=\"message_head\"><cite>" . $lang_module['content_exp_date'] . ":</cite> <span class=\"timestamp\">" . $lang_module['content_notetime'] . "</span></p>\n";
  590. $contents .= "<div class=\"message_body\"><center> \n";
  591. $contents .= "<input name=\"exp_date\" id=\"exp_date\" value=\"" . $exp_date . "\" style=\"width: 90px;\" maxlength=\"10\" type=\"text\">\n";
  592. $contents .= "<img src=\"" . NV_BASE_SITEURL . "images/calendar.jpg\" widht=\"18\" style=\"cursor: pointer; vertical-align: middle;\" onclick=\"popCalendar.show(this, 'exp_date', 'dd.mm.yyyy', false);\" alt=\"\" height=\"17\">\n";
  593. $contents .= "<select name=\"ehour\">\n";
  594. for ( $i = 0; $i < 24; $i ++ )
  595. {
  596. $contents .= "<option value=\"" . $i . "\"" . ( ( $i == $ehour ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  597. }
  598. $contents .= "</select>:<select name=\"emin\">\n";
  599. for ( $i = 0; $i < 60; $i ++ )
  600. {
  601. $contents .= "<option value=\"" . $i . "\"" . ( ( $i == $emin ) ? " selected=\"selected\"" : "" ) . ">" . str_pad( $i, 2, "0", STR_PAD_LEFT ) . "</option>\n";
  602. }
  603. $contents .= "</select>\n";
  604. $contents .= "</center>";
  605. $contents .= "<div style=\"margin-top: 10px;\"><input type=\"checkbox\" value=\"1\" name=\"archive\" " . ( ( $rowcontent['archive'] ) ? " checked=\"checked\"" : "" ) . "> <label>" . $lang_module['content_archive'] . "</label></div>\n";
  606. $contents .= "</div>\n";
  607. $contents .= "</li>\n";
  608. $contents .= "<li>\n";
  609. $contents .= "<p class=\"message_head\"><cite>" . $lang_module['content_extra'] . ":</cite></p>\n";
  610. $contents .= "<div class=\"message_body\">\n";
  611. $contents .= "<div style=\"margin-bottom: 2px;\"><input type=\"checkbox\" value=\"1\" name=\"inhome\" " . ( ( $rowcontent['inhome'] ) ? " checked=\"checked\"" : "" ) . "><label>" . $lang_module['content_inhome'] . "</label></div>\n";
  612. $contents .= "<div style=\"margin-bottom: 2px;\"><label>" . $lang_module['content_allowed_comm'] . "</label> \n";
  613. $contents .= "<select name=\"allowed_comm\">\n";
  614. while ( list( $comm_i, $title_i ) = each( $array_allowed_comm ) )
  615. {
  616. $sl = "";
  617. if ( $comm_i == $rowcontent['allowed_comm'] )
  618. {
  619. $sl = " selected=\"selected\"";
  620. }
  621. $contents .= "<option value=\"" . $comm_i . "\" " . $sl . ">" . $title_i . "</option>\n";
  622. }
  623. $contents .= "</select></div>\n";
  624. $contents .= "<div style=\"margin-bottom: 2px;\"><input type=\"checkbox\" value=\"1\" name=\"allowed_rating\" " . ( ( $rowcontent['allowed_rating'] ) ? " checked=\"checked\"" : "" ) . "><label>" . $lang_module['content_allowed_rating'] . "</label></div>\n";
  625. $contents .= "<div style=\"margin-bottom: 2px;\"><input type=\"checkbox\" value=\"1\" name=\"allowed_send\" " . ( ( $rowcontent['allowed_send'] ) ? " checked=\"checked\"" : "" ) . "><label>" . $lang_module['content_allowed_send'] . "</label></div>\n";
  626. $contents .= "<div style=\"margin-bottom: 2px;\"><input type=\"checkbox\" value=\"1\" name=\"allowed_print\" " . ( ( $rowcontent['allowed_print'] ) ? " checked=\"checked\"" : "" ) . "><label>" . $lang_module['content_allowed_print'] . "</label></div>\n";
  627. $contents .= "<div style=\"margin-bottom: 2px;\"><input type=\"checkbox\" value=\"1\" name=\"allowed_save\" " . ( ( $rowcontent['allowed_save'] ) ? " checked=\"checked\"" : "" ) . "><label>" . $lang_module['content_allowed_save'] . "</label></div>\n";
  628. $contents .= "</div>\n";
  629. $contents .= "</ol>\n";
  630. $contents .= "<p class=\"collapse_buttons\"><a href=\"#\" class=\"collpase_all_message\">" . $lang_module['content_allcollapse'] . "</a><a href=\"#\" class=\"show_all_message\">" . $lang_module['content_allshow'] . "</a></p>\n";
  631. //end
  632. $contents .= "</td>";
  633. }
  634. else{
  635. $contents .= "<td>";
  636. $contents .= " <li>\n";
  637. $contents .= " <p class=\"message_head\"><cite>" . $lang_module['content_keywords'] . ":</cite> <span class=\"timestamp\"></span></p>\n";
  638. $contents .= " <div class=\"message_body\">\n";
  639. $contents .= " <p>" . $lang_module['content_keywords_note'] . " <a onclick=\"create_keywords();\" href=\"javascript:void(0);\">" . $lang_module['content_clickhere'] . "</a></p>\n";
  640. $contents .= " <textarea rows=\"3\" cols=\"20\" id=\"keywords\" name=\"keywords\" style=\"width: 250px;\">" . $rowcontent['keywords'] . "</textarea>\n";
  641. $contents .= " </div>\n";
  642. $contents .= " </li>\n";
  643. $contents .= "</td>";
  644. }
  645. $contents .= "</tr>";
  646. $contents .= "</table>";
  647. $contents .= "<div style=\"margin-bottom: 1em;\"><label><strong>" . $lang_module['content_bodytext'] . "</strong>" . $lang_module['content_bodytext_note'] . "</label><br>\n";
  648. if ( defined( 'NV_EDITOR' ) and function_exists( 'nv_aleditor' ) )
  649. {
  650. $contents .= nv_aleditor( 'bodytext', '810px', '300px', $rowcontent['bodytext'] );
  651. }
  652. else
  653. {
  654. $contents .= "<textarea style=\"width: 810px\" name=\"bodytext\" id=\"bodytext\" cols=\"20\" rows=\"15\">" . $rowcontent['bodytext'] . "</textarea>";
  655. }
  656. $contents .= "</div>\n";
  657. $contents .= "<div style=\"margin-bottom: 1em;\"><label><strong>" . $lang_module['content_author'] . "</strong></label><br>\n";
  658. $contents .= "<input type=\"text\" maxlength=\"255\" value=\"" . $rowcontent['author'] . "\" name=\"author\" style=\"width: 530px;\"></div>\n";
  659. $contents .= "<div style=\"margin-bottom: 1em;\"><label><strong>" . $lang_module['content_sourceid'] . "</strong></label><br>\n";
  660. $contents .= "<select name=\"sourceid\" style=\"width: 530px;\">\n";
  661. while ( list( $sourceid_i, $title_i ) = each( $array_source_module ) )
  662. {
  663. $sl = "";
  664. if ( $sourceid_i == $rowcontent['sourceid'] )
  665. {
  666. $sl = " selected=\"selected\"";
  667. }
  668. $contents .= "<option value=\"" . $sourceid_i . "\" " . $sl . ">" . $title_i . "</option>\n";
  669. }
  670. $contents .= "</select><br>\n";
  671. $contents .= "<input type=\"text\" maxlength=\"255\" id=\"AjaxSourceText\" value=\"" . $rowcontent['sourcetext'] . "\" name=\"sourcetext\" style=\"width: 530px;\"></div>\n";
  672. $contents .= "<div style=\"margin-bottom: 1em;\"><input type=\"checkbox\" value=\"1\" name=\"copyright\" " . ( ( $rowcontent['copyright'] ) ? " checked=\"checked\"" : "" ) . "> <label>" . $lang_module['content_copyright'] . "</label></div>\n";
  673. $contents .= "<center>";
  674. if ( $rowcontent['status'] == 1 )
  675. {
  676. $contents .= "<input name=\"statussave\" type=\"submit\" value=\"" . $lang_module['save'] . "\" />";
  677. }
  678. else
  679. {
  680. $contents .= "<input name=\"status0\" type=\"submit\" value=\"" . $lang_module['save_temp'] . "\" />";
  681. if($can_publish){
  682. $contents .= "<input name=\"status1\" type=\"submit\" value=\"" . $lang_module['publtime'] . "\" />";
  683. }
  684. }
  685. $contents .= "</center>\n";
  686. $contents .= "</form>\n";
  687. $contents .= "<script type=\"text/javascript\">\n";
  688. $contents .= '$("input[name=selectimg]").click(function(){
  689. var area = "homeimg";
  690. var path= "' . NV_UPLOADS_DIR . '/' . $module_name . '";
  691. var currentpath= "' . NV_UPLOADS_DIR . '/' . $module_name . '/' . date( "Y_m" ) . '";
  692. var type= "image";
  693. nv_open_browse_file("' . NV_BASE_ADMINURL . 'index.php?' . NV_NAME_VARIABLE . '=upload&popup=1&area=" + area+"&path="+path+"&type="+type+"&currentpath="+currentpath, "NVImg", "850", "400","resizable=no,scrollbars=no,toolbar=no,location=no,status=no");
  694. return false;
  695. });';
  696. $contents .= "$(document).ready(function() {\n";
  697. $contents .= " $(\"#AjaxSourceText\").autocomplete(\n";
  698. $contents .= " \"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=sourceajax\",\n";
  699. $contents .= " {\n";
  700. $contents .= " delay:10,\n";
  701. $contents .= " minChars:2,\n";
  702. $contents .= " matchSubset:1,\n";
  703. $contents .= " matchContains:1,\n";
  704. $contents .= " cacheLength:10,\n";
  705. $contents .= " onItemSelect:selectItem,\n";
  706. $contents .= " onFindValue:findValue,\n";
  707. $contents .= " formatItem:formatItem,\n";
  708. $contents .= " autoFill:true\n";
  709. $contents .= " }\n";
  710. $contents .= " );\n";
  711. $contents .= "\n";
  712. $contents .= " $(\"#AjaxTopicText\").autocomplete(\n";
  713. $contents .= " \"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=topicajax\",\n";
  714. $contents .= " {\n";
  715. $contents .= " delay:10,\n";
  716. $contents .= " minChars:2,\n";
  717. $contents .= " matchSubset:1,\n";
  718. $contents .= " matchContains:1,\n";
  719. $contents .= " cacheLength:10,\n";
  720. $contents .= " onItemSelect:selectItem,\n";
  721. $contents .= " onFindValue:findValue,\n";
  722. $contents .= " autoFill:true\n";
  723. $contents .= " }\n";
  724. $contents .= " );\n";
  725. $contents .= "\n";
  726. $contents .= "});\n";
  727. $contents .= "</script>\n";
  728. include ( NV_ROOTDIR . "/includes/header.php" );
  729. echo nv_admin_theme( $contents );
  730. include ( NV_ROOTDIR . "/includes/footer.php" );
  731. ?>