PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/music/funcs/videosendmail.php

http://nukeviet-music.googlecode.com/
PHP | 113 lines | 95 code | 12 blank | 6 comment | 7 complexity | bac31875f9de7bd55cbea7bd2aa11efc MD5 | raw file
  1. <?php
  2. /* *
  3. * @Project NUKEVIET-MUSIC
  4. * @Author Phan Tan Dung (phantandung92@gmail.com)
  5. * @Copyright (C) 2011 Freeware
  6. * @Createdate 26/01/2011 10:12 AM
  7. */
  8. if( ! defined( 'NV_IS_MOD_MUSIC' ) ) die( 'Stop!!!' );
  9. $id = $nv_Request->get_int( 'id', 'get', 0 );
  10. if( $id > 0 )
  11. {
  12. $result = "";
  13. $check = false;
  14. $checkss = $nv_Request->get_string( 'checkss', 'post', '' );
  15. if( defined( 'NV_IS_ADMIN' ) )
  16. {
  17. $name = $admin_info['username'];
  18. $youremail = $admin_info['email'];
  19. }
  20. elseif( defined( 'NV_IS_USER' ) )
  21. {
  22. $name = $user_info['username'];
  23. $youremail = $user_info['email'];
  24. }
  25. else
  26. {
  27. $name = filter_text_input( 'name', 'post', '', 1 );
  28. $youremail = filter_text_input( 'youremail', 'post', '' );
  29. }
  30. $to_mail = $content = "";
  31. $sql = "SELECT a.*, b.ten AS singeralias, b.tenthat AS singername FROM `" . NV_PREFIXLANG . "_" . $module_data . "_video` AS a LEFT JOIN `" . NV_PREFIXLANG . "_" . $module_data . "_singer` AS b ON a.casi=b.id WHERE a.id = " . $id;
  32. $query = $db->sql_query( $sql );
  33. $video = $db->sql_fetchrow( $query );
  34. if( $nv_Request->get_int( 'send', 'post', 0 ) == 1 )
  35. {
  36. $link = NV_MY_DOMAIN . nv_url_rewrite( $mainURL . "=viewvideo/" . $id . "/" . $video['ten'], true );
  37. $link = "<a href=\"$link\">$link</a>\n";
  38. $nv_seccode = filter_text_input( 'nv_seccode', 'post', '' );
  39. $to_mail = filter_text_input( 'email', 'post', '' );
  40. $content = filter_text_input( 'content', 'post', '', 1 );
  41. $err_email = nv_check_valid_email( $to_mail );
  42. $err_youremail = nv_check_valid_email( $youremail );
  43. $err_name = "";
  44. $message = "";
  45. $success = "";
  46. if( $global_config['gfx_chk'] > 0 and ! nv_capcha_txt( $nv_seccode ) )
  47. {
  48. $err_name = $lang_global['securitycodeincorrect'];
  49. }
  50. elseif( empty( $name ) )
  51. {
  52. $err_name = $lang_module['sendmail_err_name'];
  53. }
  54. elseif( empty( $err_email ) and empty( $err_youremail ) )
  55. {
  56. $subject = "" . $lang_module['sendmail_welcome'] . ": " . $name;
  57. $message .= "" . $lang_module['sendmail_welcome_1'] . "
  58. <strong>" . $global_config['site_name'] . "</strong>
  59. " . $lang_module['sendmail_welcome_2'] . "<br />
  60. <br />" . $lang_module['video'] . "<strong> " . $video['tname'] . "</strong> " . $lang_module['sendmail_singer_show'] . " <strong> " . ( $video['singername'] ? $video['singername'] : $lang_module['unknow'] ) . " </strong> " . $lang_module['show_2'] . ".<br/>
  61. <br />" . $lang_module['message'] . ": " . $content . "<br />
  62. <br /><strong>" . $lang_module['sendmail_welcome_3'] . ": </strong><br />" . $link . "";
  63. $from = array( $name, $youremail );
  64. $check = nv_sendmail( $from, $to_mail, $subject, $message );
  65. if( $check )
  66. {
  67. $success = "" . $lang_module['send_mail_success'] . "<strong> " . $to_mail . "</strong>";
  68. }
  69. else
  70. {
  71. $success = $lang_module['send_mail_err'];
  72. }
  73. }
  74. $result = array(
  75. "err_name" => $err_name,
  76. "err_email" => $err_email,
  77. "err_yourmail" => $err_youremail,
  78. "send_success" => $success,
  79. "check" => $check
  80. );
  81. }
  82. $sendmail = array(
  83. "id" => $id,
  84. "checkss" => md5( $id . session_id() . $global_config['sitekey'] ),
  85. "v_name" => $name,
  86. "video" => $video['tname'],
  87. "singer" => ( $video['singername'] ? $video['singername'] : $lang_module['unknow'] ),
  88. "v_mail" => $youremail,
  89. "to_mail" => $to_mail,
  90. "content" => $content,
  91. "result" => $result,
  92. "action" => "" . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&amp;" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=videosendmail&amp;id=" . $id
  93. );
  94. $contents = nv_sendmail_video_themme( $sendmail );
  95. include ( NV_ROOTDIR . "/includes/header.php" );
  96. echo $contents;
  97. include ( NV_ROOTDIR . "/includes/footer.php" );
  98. }
  99. Header( "Location: " . $global_config['site_url'] );
  100. exit();
  101. ?>