PageRenderTime 29ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/01.Source/01.CORE/modules/video/admin/edit.php

http://creative-portal.googlecode.com/
PHP | 108 lines | 104 code | 0 blank | 4 comment | 12 complexity | 78e8aea0129ab0693c3fc12f3cbc94e1 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. if ( ! defined( 'NV_IS_VIDEO_ADMIN' ) ) { die( 'Stop!!!' ); }
  3. $page_title = "S?a Video";
  4. $edit = 0;
  5. $error = "";
  6. $id = $nv_Request->get_int( 'id', 'post,get',0 );
  7. if ( $nv_Request->get_int( 'edit', 'post' ) == 1 )
  8. {
  9. $title = filter_text_input( 'title', 'post', '', 1 );
  10. $duongdan = filter_text_input( 'duongdan', 'post', '', 1 );
  11. $thumb = filter_text_input( 'thumb', 'post', '', 1 );
  12. $theloai = $nv_Request->get_int( 'theloai', 'post',0 );
  13. $who_post = filter_text_input( 'who_post', 'post', '', 1 );
  14. if ( empty( $title ) ) { $error = "L?i: Ch?a ?i?n tęn album"; } else
  15. if ( empty( $thumb ) ) { $error = "L?i: Ch?a ?i?n thông tin ?nh hi?n th?"; } else
  16. if ( empty( $who_post ) ) { $error = "L?i: Ch?a có ng??i ??ng"; }
  17. else
  18. {
  19. $query = mysql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "` SET `title` = " . $db->dbescape( $title ) . " WHERE `id` =" . $id . "");
  20. $query = mysql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "` SET `thumb` = " . $db->dbescape( $thumb ) . " WHERE `id` =" . $id . "");
  21. $query = mysql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "` SET `duongdan` = " . $db->dbescape( $duongdan ) . " WHERE `id` =" . $id . "");
  22. $query = mysql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "` SET `theloai` = " . $db->dbescape( $theloai ) . " WHERE `id` =" . $id . "");
  23. $query = mysql_query("UPDATE `" . NV_PREFIXLANG . "_" . $module_data . "` SET `who_post` = " . $db->dbescape( $who_post ) . " WHERE `id` =" . $id . "");
  24. if ($query)
  25. {
  26. Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name); die();
  27. }
  28. else { $error = "Có l?i trong quá trěnh l?u d? li?u hăy ki?m tra l?i"; }
  29. }
  30. }
  31. if ( $error != "" )
  32. {
  33. $contents .= "<div class=\"quote\" style=\"width:780px;\">\n";
  34. $contents .= "<blockquote class=\"error\"><span>" . $error . "</span></blockquote>\n";
  35. $contents .= "</div>\n";
  36. $contents .= "<div class=\"clear\"></div>\n";
  37. }
  38. $sql = "SELECT id, title, thumb, duongdan, theloai, who_post FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `id` = '" . $id . "'";
  39. $resuilt = $db->sql_query( $sql );
  40. $row = $db->sql_fetchrow( $resuilt );
  41. $contents .= "<form action=\"" . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=edit&id=".$id."\" enctype=\"multipart/form-data\" method=\"post\">";
  42. $contents .= "<br /><p><strong>Nh?p vŕo ??y ?? thông tin cho album:</strong> L?u ý các thông tin ??u lŕ b?t bu?c</p>";
  43. $contents .= " <table class=\"tab1\">\n";
  44. $contents .= " <tr>\n";
  45. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  46. $contents .= " <td width=\"30%\"><strong>Tęn video:</strong></td>\n";
  47. $contents .= " <td>\n";
  48. $contents .= " <input type=\"text\" value=\"".$row['title']."\" name=\"title\" size=\"100\">\n";
  49. $contents .= " </td>\n";
  50. $contents .= " </tr>\n";
  51. $contents .= " <tr>\n";
  52. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  53. $contents .= " <td width=\"30%\"><strong>Ch?n th? lo?i:</strong>\n";
  54. $contents .= " <td>\n";
  55. $contents .= " <select name=\"theloai\" >";
  56. $sql = "SELECT id, num, title FROM `" . NV_PREFIXLANG . "_" . $module_data . "_category` ORDER BY num DESC";
  57. $resuilt = $db->sql_query( $sql );
  58. while ( $row = $db->sql_fetchrow( $resuilt ) )
  59. {
  60. $contents .= " <option value=\"".$row['num']."\">".$row['title']."</option>";
  61. }
  62. $contents .= " </select>\n";
  63. $contents .= " </td>\n";
  64. $contents .= " </tr>\n";
  65. $contents .= " <tr>\n";
  66. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  67. $sql = "SELECT id, title, thumb, duongdan, theloai, who_post FROM `" . NV_PREFIXLANG . "_" . $module_data . "` WHERE `id` = '" . $id . "'";
  68. $resuilt = $db->sql_query( $sql );
  69. $row = $db->sql_fetchrow( $resuilt );
  70. $contents .= " <td width=\"30%\"><strong>Ng??i ??ng:</strong></td>\n";
  71. $contents .= " <td colspan=\"2\">\n";
  72. $contents .= " <input type=\"text\" value=\"".$row['who_post']."\" name=\"who_post\" size=\"100\">\n";
  73. $contents .= " </td>\n";
  74. $contents .= " </tr>\n";
  75. $contents .= " <tr>\n";
  76. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  77. $contents .= " <td width=\"30%\"><strong>?nh hi?n th?:</strong></td>\n";
  78. $contents .= " <td style=\"background:#eee;\" valign=\"middle\">
  79. <input style=\"width: 400px;\" value=\"".$row['thumb']."\" name=\"thumb\" id=\"thumb\" type=\"text\" />
  80. </td>
  81. <td style=\"background:#eee;\" valign=\"middle\">
  82. <input value=\"Ch?n ?nh\" name=\"selectimg\" type=\"button\"/>
  83. <script type=\"text/javascript\">
  84. $(\"input[name=selectimg]\").click(function()
  85. {
  86. var area = \"thumb\"; // return value area
  87. var type = \"image\";
  88. var path = \"".NV_UPLOADS_DIR . "/" . $module_name."/thumb\";
  89. nv_open_browse_file(\"".NV_BASE_ADMINURL . 'index.php?' . NV_NAME_VARIABLE . '=upload&popup=1&area=" + area+"&path="+path+"&type="+type, "NVImg", "850", "500","resizable=no,scrollbars=no,toolbar=no,location=no,status=no'."\");
  90. return false;
  91. });
  92. </script></td> ";
  93. $contents .= " </tr>\n";
  94. $contents .= "</table>\n";
  95. $contents .= "<table class=\"tab2\" align=\"center\">\n";
  96. $contents .= " <tr>\n";
  97. $contents .= " <td style=\"text-align:center;\">\n";
  98. $contents .= " <input type=\"submit\" value=\"L?u\"/>\n";
  99. $contents .= " <input name=\"edit\" type=\"hidden\" value=\"1\" />\n";
  100. $contents .= " <input type=\"hidden\" name =\"" . NV_NAME_VARIABLE . "\"value=\"" . $module_name . "\" />"; $contents .= " <input type=\"hidden\" name =\"" . NV_OP_VARIABLE . "\"value=\"" . $op . "\" />";
  101. $contents .= " </td>\n";
  102. $contents .= " </tr>\n";
  103. $contents .= " </table>\n";
  104. $contents .= "</form>\n";
  105. include ( NV_ROOTDIR . "/includes/header.php" );
  106. echo nv_admin_theme( $contents );
  107. include ( NV_ROOTDIR . "/includes/footer.php" );
  108. ?>