54.patch

Suneesh PM, 05/29/2010 06:14 am

Download (44.9 kB)

 
b/.htaccess
68 68
RewriteRule ^search/(.*)/(.*)/(.*)/(.*)/(.*)/(.*) advanced_search.php?words=$1&channels=$2&user=$3&relevence=$4&sort=$5&page=$6
69 69
RewriteRule ^style/(.*)/ style.php?css=$1 [L,QSA]
70 70
RewriteRule ^privacy/ user_privacy.php [L,QSA]
71
RewriteRule ^response/(.*)/videos/(.*) video_responses.php?video_id=$1&page=$2 [L,QSA]
72
RewriteRule ^verify/response/(.*)/(.*)/(.*)/ video_response_verify.php?u=$1&i=$2&k=$3
71 73
RewriteRule ^([^/\.]+)/favorites/(.*) user_favorites.php?user_name=$1&page=$2
72 74
RewriteRule ^([^/\.]+)/playlist/(.*) user_playlist.php?user_name=$1&page=$2
73 75
RewriteRule ^([^/\.]+)/friends/videos/(.*) user_friends_videos.php?user_name=$1&page=$2 [L,QSA]
b/include/class.video.php
582 582
            return 0;
583 583
        }
584 584
    }
585
    
586
    function get_response_videos($video_id, $limit = '')
587
    {
588
        global $conn , $servers;
589
        
590
        if (! empty($limit))
591
        {
592
            $limit = 'LIMIT ' . (int) $limit;
593
        }
594
        
595
        $sql = "SELECT v.* FROM `videos` AS `v`,`video_responses` AS `vr` WHERE
596
                vr.video_response_to_video_id='" . (int) $video_id . "' AND
597
                vr.video_response_active='1' AND
598
                vr.video_response_video_id=v.video_id
599
                ORDER BY vr.video_response_add_time DESC
600
                $limit";
601
        $result = mysql_query($sql) or mysql_die($sql);
602
        
603
        $video_info = array();
604
        
605
        if (mysql_num_rows($result) > 0)
606
        {
607
            while ($video = mysql_fetch_assoc($result))
608
            {
609
                $video['video_thumb_url'] = $servers[$video['video_thumb_server_id']];
610
                $video_info[] = $video;
611
            }
612
        }
613
        
614
        return $video_info;
615
    }
585 616
}
b/include/functions_insert.php
1075 1075
    $list .= '</div>';
1076 1076
    echo $list;
1077 1077
}
1078

  
1079
function insert_video_response_count($a)
1080
{
1081
    global $conn;
1082
    
1083
    $sql = "SELECT count(*) AS `count` FROM `video_responses` WHERE
1084
           `video_response_to_video_id`='" . (int) $a['video_id'] . "' AND
1085
           `video_response_active`='1'";
1086
    $result = mysql_query($sql) or mysql_die($sql);
1087
    $tmp = mysql_fetch_array($result);
1088
    return $tmp['count'];
1089
}
b/include/language/en/lang_video_response.php
1
<?php
2

  
3
$lang['invalid_video_id'] = 'Invalid video id';
4
$lang['video_removed'] = 'Video has been removed successfully.';
5
$lang['invalid_vcode'] = 'Invalid activation code or already activated!';
6
$lang['video_response_activated'] = 'Video response has been activated.';
7
$lang['video_response_rejected'] = 'Video response has been rejected.';
b/install/sql/upgrade_2.7_to_2.8.sql
20 20
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
21 21

  
22 22
INSERT INTO `config` (`config_name`, `config_value`) VALUES ('youtube_player', 'youtube');
23

  
24
CREATE TABLE IF NOT EXISTS `video_responses` (
25
  `video_response_id` int(11) NOT NULL auto_increment,
26
  `video_response_video_id` int(11) NOT NULL,
27
  `video_response_to_video_id` int(11) NOT NULL,
28
  `video_response_active` int(1) NOT NULL default '0',
29
  `video_response_add_time` int(11) NOT NULL,
30
  PRIMARY KEY  (`video_response_id`)
31
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
32

  
33
INSERT INTO `email_templates` (`email_id` ,`email_subject` ,`email_body` ,`comment`) VALUES ('video_response_notify', '[SITE_NAME] - Video response to "[VIDEO_TITLE]"', '<p><a href="[SITE_URL]/[USERNAME]">[USERNAME]</a> has posted a video in response to <a href="[VIDEO_URL]">[VIDEO_TITLE]</a></p> <p>Response Video: <a href="[RESPONSE_VIDEO_URL]">[RESPONSE_VIDEO_TITLE]</a></p><p>This video requires your approval. You can approve or reject it by visiting the following link.</p><p><a href="[VERIFY_LINK]">[VERIFY_LINK]</a></p><p>Thanks</p><p><a href="[SITE_URL]">[SITE_NAME]</a> Team</p>', 'video response notify');
b/install/sql/vshare.sql
180 180
INSERT INTO `email_templates` (`email_id`, `email_subject`, `email_body`, `comment`) VALUES('upload_notify_admin', 'New Video Upload at [SITE_NAME] by [USERNAME]', '<p>USER ID: [USER_ID]</p><p>USER IP: [USER_IP]</p><p>USERNAME: [USERNAME]</p><p>TITLE: [TITLE]</p><p>DESCRIPTION: [DESCRIPTION]</p><p>KEYWORDS: [KEYWORDS]</p><p>CHANNEL: [CHANNELS]</p><p>TYPE: [TYPE]</p><p>VIDEO URL: [VIDEO_URL]</p>', 'Admin Notification for video upload');
181 181
INSERT INTO `email_templates` (`email_id`, `email_subject`, `email_body`, `comment`) VALUES('abuse_report', 'Abuse report on [VIDEO_TITLE]', '<p>Hi Admin,</p>  <p>Following video is reported as Inappropriate.</p><p><a href="[VIDEO_URL] ">[VIDEO_URL]</a></p><p>Abuse Type: <font color="#000000">[TYPE_ABUSE]</font></p><p>Comments: <font color="#000000">[ABUSE_COMMENTS]</font></p><p>Reported by:</p><p>User Name: [USER_NAME]<br />IP Address: &nbsp;[REMOTE_ADDR]</p><p>Thanks,</p><p><a href="[SITE_URL]">[SITE_NAME]</a></p>', 'Report Inappropriate Video');
182 182
INSERT INTO `email_templates` (`email_id`, `email_subject`, `email_body`, `comment`) VALUES('delete_user', '[SITE_NAME] Account Delete Verification - [USERNAME]', '<p>Hi [USERNAME],</p><p>You or some one from IP: [USER_IP] requested to delete the account [USERNAME]</p><p><a href="[SITE_URL]/[USERNAME]">[SITE_URL]/[USERNAME]</a></p><p>To delete the account, click the link below</p><p><a href="[VERIFY_URL]">[VERIFY_URL]</a></p><p>Thank you,</p><p><a href="[SITE_URL]">[SITE_NAME]</a></p>', 'Account delete verification Mail');
183
INSERT INTO `email_templates` (`email_id` ,`email_subject` ,`email_body` ,`comment`) VALUES('video_response_notify', '[SITE_NAME] - Video response to "[VIDEO_TITLE]"', '<p><a href="[SITE_URL]/[USERNAME]">[USERNAME]</a> has posted a video in response to <a href="[VIDEO_URL]">[VIDEO_TITLE]</a></p> <p>Response Video: <a href="[RESPONSE_VIDEO_URL]">[RESPONSE_VIDEO_TITLE]</a></p><p>This video requires your approval. You can approve or reject it by visiting the following link.</p><p><a href="[VERIFY_LINK]">[VERIFY_LINK]</a></p><p>Thanks</p><p><a href="[SITE_URL]">[SITE_NAME]</a> Team</p>', 'video response notify');
183 184

  
184 185
-- Table structure for table `favourite`
185 186

  
......
808 809
  `admin_log_ip` varchar(255) NOT NULL,
809 810
  PRIMARY KEY  (`admin_log_id`)
810 811
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
812

  
813
-- Table structure for table `video_responses`
814

  
815
CREATE TABLE IF NOT EXISTS `video_responses` (
816
  `video_response_id` int(11) NOT NULL auto_increment,
817
  `video_response_video_id` int(11) NOT NULL,
818
  `video_response_to_video_id` int(11) NOT NULL,
819
  `video_response_active` int(1) NOT NULL default '0',
820
  `video_response_add_time` int(11) NOT NULL,
821
  PRIMARY KEY  (`video_response_id`)
822
) ENGINE=MyISAM  DEFAULT CHARSET=utf8;
823

  
824
-- Dumping data for table `video_responses`
b/templates/css/style.css
629 629
    margin-bottom: 5px;
630 630
    color: #666666;
631 631
}
632
.video-response {
633
   float:left;
634
   height:120px;
635
   width:112px;
636
   margin:2px 3px;
637
   overflow:hidden;
638
   text-align:left;    
639
}
632 640
/*view_video.tpl only = >   = > end*/
633 641

  
634 642
.formHighlight {
......
1981 1989
	background-color: #999999;
1982 1990
}
1983 1991

  
1992
/*video reponses*/
1993
div.response-body {
1994
   margin: 5px 5px;
1995
}
1996
div.response-body div.video-info {
1997
   width: 600px;
1998
   float: left;
1999
   overflow: hidden;
2000
}
2001
div.response-body div.video-info span.video-title {
2002
   font-size: 16px;
2003
   font-weight: bold;
2004
}
2005
div.response-body div.video-info div.box1 {
2006
   width: 140px;
2007
   float: left;
2008
}
2009
div.response-body div.video-info div.box2 {
2010
   width: 400px;
2011
   float: left;
2012
   padding: 2px;
2013
}
2014
div.response-body div.video-info div.box2 span {
2015
   margin: 2px;
2016
   display: block;
2017
}
2018
div.response-body div.video-info div.box2 span.video_title a {
2019
   color: #0066FF;
2020
}
2021
div.response-body div.user-info {
2022
   width: 250px;
2023
   float: left;
2024
}
2025
div.response-body div.user-info span {
2026
   margin: 2px 5px;
2027
   display: block;
2028
}
2029
div.response-body select.video-options {
2030
   height: 230px;
2031
   margin-bottom: 5px;
2032
   width: 320px;
2033
}
2034
div.response-body h3 {
2035
   margin: 0;
2036
}
b/templates/upload_video_response.tpl
1
<h2>You are posting a video response to:</h2>
2
<div class="response-body clearfix">
3
    <div class="video-info">
4
        <span class="video-title">{$view.video_info.video_title}</span>
5
        <div class="box1">
6
            <a href="{$base_url}/view/{$video_info.video_id}/{$video_info.video_seo_name}/">
7
                <img class="preview" src="{$video_info.video_thumb_url}/thumb/{$video_info.video_folder}1_{$video_info.video_id}.jpg" width="120px" height="90" />
8
            </a>
9
        </div>
10
        
11
        <div class="box2">
12
            <span class="video_title">
13
                <a href="{$base_url}/view/{$video_info.video_id}/{$video_info.video_seo_name}/">
14
                    {$video_info.video_title}
15
                </a>
16
            </span>
17
            
18
            <span class="video_description">
19
                {$video_info.video_description}
20
            </span>
21
            
22
            <span class="video_details">
23
                Added on  {$video_info.video_add_date|date_format}
24
            </span>
25
            
26
            <span class="video_details">
27
                Time: {$video_info.video_length} |
28
                Views: {$video_info.video_view_number} |
29
                Comments: {$video_info.video_com_num} |
30
                Rating: {insert name=show_rate assign=rate rte=$video_info.video_rate rated=$video_info.video_rated_by}{$rate}
31
            </span>
32
        </div>
33
    </div>
34
    
35
    <div class="user-info">
36
        {insert name=id_to_name assign=uname un=$video_info.video_user_id}
37
        <a href="{$base_url}/{$uname}">
38
            {insert name=member_img UID=$video_info.video_user_id}
39
        </a>
40
        <span>From: <a href="{$base_url}/{$uname}">{$uname}</a></span>
41
        {insert name=video_count assign=vdo_count type=public uid=$video_info.video_user_id}
42
        <span>Videos: {$vdo_count}</span>
43
    </div>
44
</div>
45

  
46
<hr />
47

  
48
<div class="response-body clearfix">
49
    {if $video_response_added eq '0'}
50
    <div class="video-info" style="float: right;">
51
        {if $user_videos|@count gt '0'}
52
            <form method="post" action="?vid={$video_info.video_id}">
53
           <select name="video_response_video_id" class="video-options" multiple="multiple">
54
               {section name=i loop=$user_videos}
55
                   <option value="{$user_videos[i].video_id}">
56
                      {if $user_videos[i].video_already_response eq '1'}
57
                      *
58
                      {/if}
59
                      {$user_videos[i].video_title}
60
                   </option>
61
               {/section}
62
           </select>
63
              <input type="hidden" name="video_response_to_video_id" value="{$video_info.video_id}" />
64
              <input type="submit" name="submit" class="button" value="Use the selected video" />
65
           </form>
66
        {else}
67
            <center><p>There is no video found.</p></center>
68
        {/if}
69
    </div>
70
    <div class="user-info">
71
        <h3>Choose one of your existing videos as a response</h3>
72
        <span>* Indicates the video has already been used for another video response. Selecting a video marked as already having been used will remove the old link.</span>
73
    </div>
74
    {else}
75
        <div class="vshare-success">
76
            <h3>You have successfully completed your Video Response! </h3>
77
            <span><small>Your video response will be posted after it has been approved by the video owner.</small></span>
78
        </div>
79
    {/if}
80
</div>
b/templates/video_response_verify.tpl
1
<div class="response-body clearfix">
2
    <div class="video-info">
3
        <span class="video-title">{$video_info.video_title}</span>
4
        <div class="box1">
5
            <a href="{$base_url}/view/{$video_info.video_id}/{$video_info.video_seo_name}/">
6
                <img class="preview" src="{$video_info.video_thumb_url}/thumb/{$video_info.video_folder}1_{$video_info.video_id}.jpg" width="120px" height="90" />
7
            </a>
8
        </div>
9
        
10
        <div class="box2">
11
            <span class="video_title">
12
                <a href="{$base_url}/view/{$video_info.video_id}/{$video_info.video_seo_name}/">
13
                    {$video_info.video_title}
14
                </a>
15
            </span>
16
            
17
            <span class="video_description">
18
                {$video_info.video_description}
19
            </span>
20
            
21
            <span class="video_details">
22
                Added on  {$video_info.video_add_date|date_format}
23
            </span>
24
            
25
            <span class="video_details">
26
                Time: {$video_info.video_length} |
27
                Views: {$video_info.video_view_number} |
28
                Comments: {$video_info.video_com_num} |
29
                Rating: {insert name=show_rate assign=rate rte=$video_info.video_rate rated=$video_info.video_rated_by}{$rate}
30
            </span>
31
        </div>
32
    </div>
33
    
34
    <div class="user-info">
35
        {insert name=id_to_name assign=uname un=$video_info.video_user_id}
36
        <a href="{$base_url}/{$uname}">
37
            {insert name=member_img UID=$video_info.video_user_id}
38
        </a>
39
        <span>From: <a href="{$base_url}/{$uname}">{$uname}</a></span>
40
        {insert name=video_count assign=vdo_count type=public uid=$video_info.video_user_id}
41
        <span>Videos: {$vdo_count}</span>
42
    </div>
43
</div>
44

  
45
<div>
46
    <center>
47
    <form action="" method="post">
48
        <input type="submit" value="Accept this video" name="action" />
49
        <input type=submit value="Reject this video" name="action" onclick="return confirm('Are you sure you want to reject this request?');" />
50
    </form>
51
    </center>
52
</div>
b/templates/video_responses.tpl
1
<div class="response-body clearfix">
2
    <div class="video-info">
3
        <span class="video-title">{$view.video_info.video_title}</span>
4
        <div class="box1">
5
            <a href="{$base_url}/view/{$view.video_info.video_id}/{$view.video_info.video_seo_name}/">
6
                <img class="preview" src="{$view.video_info.video_thumb_url}/thumb/{$view.video_info.video_folder}1_{$view.video_info.video_id}.jpg" width="120px" height="90" />
7
            </a>
8
        </div>
9
        
10
        <div class="box2">
11
            <span class="video_title">
12
                <a href="{$base_url}/view/{$view.video_info.video_id}/{$view.video_info.video_seo_name}/">
13
                    {$view.video_info.video_title}
14
                </a>
15
            </span>
16
            
17
            <span class="video_description">
18
                {$view.video_info.video_description}
19
            </span>
20
            
21
            <span class="video_details">
22
                Added on  {$view.video_info.video_add_date|date_format}
23
            </span>
24
            
25
            <span class="video_details">
26
                Time: {$view.video_info.video_length} |
27
                Views: {$view.video_info.video_view_number} |
28
                Comments: {$view.video_info.video_com_num} |
29
                Rating: {insert name=show_rate assign=rate rte=$view.video_info.video_rate rated=$view.video_info.video_rated_by}{$rate}
30
            </span>
31
        </div>
32
    </div>
33
    
34
    <div class="user-info">
35
        {insert name=id_to_name assign=uname un=$view.video_info.video_user_id}
36
        <a href="{$base_url}/{$uname}">
37
            {insert name=member_img UID=$view.video_info.video_user_id}
38
        </a>
39
        <span>From: <a href="{$base_url}/{$uname}">{$uname}</a></span>
40
        {insert name=video_count assign=vdo_count type=public uid=$view.video_info.video_user_id}
41
        <span>Videos: {$vdo_count}</span>
42
    </div>
43
</div>
44

  
45
<div class="section bg2 clearfix">
46

  
47
    <div class="hd">
48
    
49
        <div class="hd-l">Video Responses</div>
50
        
51
        <div style="float:right;margin-right:1em;">
52
            Videos {$view.start_num}-{$view.end_num} of {$view.total}
53
        </div>
54
    
55
    </div>
56

  
57
    <div class="video_block clearfix">
58
       {section name=i loop=$view.videos}
59
            
60
           <div class="watch-video-box">
61

  
62
               <p class="video_title">
63
                   <a href="{$base_url}/view/{$view.videos[i].video_id}/{$view.videos[i].video_seo_name}/">
64
                       <img class="preview" src="{$view.videos[i].video_thumb_url}/thumb/{$view.videos[i].video_folder}1_{$view.videos[i].video_id}.jpg" width="120px" height="90" alt="{$view.videos[i].video_title}" />
65
                   </a>
66
               </p>
67

  
68
               <p class="video_title">
69
                   <a href="{$base_url}/view/{$view.videos[i].video_id}/{$view.videos[i].video_seo_name}/">{$view.videos[i].video_title|truncate:20:'...':true}</a>
70
               </p>
71

  
72
               <p class="video_details">
73
                   Added by: {insert name=id_to_name assign=uname un=$view.videos[i].video_user_id}<a href="{$base_url}/{$uname}" target="_parent">{$uname}</a>
74
               </p>
75

  
76
               <p class="video_details">
77
                   Time: {$view.videos[i].video_length}<br />
78
                   Views: {$view.videos[i].video_view_number} | {insert name=comment_count assign=commentcount vid=$view.videos[i].video_id}Comments: {$commentcount}
79
               </p>
80

  
81
               <p class="video_details">
82
                   {insert name=show_rate assign=rate rte=$view.videos[i].video_rate rated=$view.videos[i].video_rated_by}{$rate}
83
               </p>
84
                
85
                {if $smarty.session.UID eq $view.video_info.video_user_id}
86
                <p>
87
                    <form method="post" action="">
88
                        <input type="hidden" name="response_video_id" value="{$view.videos[i].video_id}" />
89
                        <input type="submit" name="remove_video" value="Remove" />
90
                    </form>
91
                </p>
92
                {/if}
93
                
94
           </div>
95
        {sectionelse}
96
            <br />
97
            <center><p>There is no response video found.</p></center>
98
        {/section}
99
    
100
    </div>
101
    
102
    {if $view.page_links ne ""}
103
        <div class="page_links">
104
            Pages: &nbsp; &nbsp; {$view.page_links}
105
        </div>
106
    {/if}
107
    
108
</div>
b/templates/view_video.tpl
12 12
    
13 13
    {insert name=advertise adv_name='player_bottom'}
14 14
    
15
    {if $view.video_info.video_response_id gt '0'}
16
    <div id="videos-details">
17
        {insert name=getfield assign=response_title table='videos' field='video_title' qfield='video_id' qvalue=$view.video_info.video_response_id}
18
        {insert name=getfield assign=response_seo_name table='videos' field='video_seo_name' qfield='video_id' qvalue=$view.video_info.video_response_id}
19
        This is a video response to <a href="{$base_url}/view/{$view.video_info.video_response_id}/{$response_seo_name}/">{$response_title}</a>
20
    </div>
21
    {/if}
22
        
15 23
    <div align="center">
16 24
        <a href="javascript:void(0);" title="FaceBook"><img src="{$img_css_url}/images/facebook.jpg" border="0" alt="facebook" onclick="window.open('http://www.facebook.com/share.php?u={$base_url}/view/{$view.video_info.video_id}/{$view.video_info.video_seo_name}/&amp;t={$view.video_info.video_title}','facebook', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=750,height=400,left = 0,top = 0');"/></a>&nbsp;
17 25
        <a href="http://digg.com/submit?phase=2&amp;url={$base_url}/view/{$view.video_info.video_id}/{$view.video_info.video_seo_name}/&amp;title={$view.video_info.video_title}" title="Digg It!"><img src="{$img_css_url}/images/digg.png" border="0" alt="digg" /></a>&nbsp;
......
124 132
    
125 133
    </div> <!-- section -->
126 134
    
135
    <div class="section clearfix">
136
    {insert name=video_response_count video_id=$view.video_info.video_id assign=response_count}
137
        <div class="hd">
138
            <div class="hd-l">
139
                Video Responses ({$response_count})
140
                
141
                {if $response_count gt '0'}
142
                    &nbsp;&nbsp;&nbsp;&nbsp;<a href="{$base_url}/response/{$view.video_info.video_id}/videos/1">View All</a>
143
                {/if}
144
            </div>
145
            
146
            <div class="hd-r"><a href="{$base_url}/upload_video_response.php?vid={$view.video_info.video_id}">Post Video Response</a></div>
147
        </div>
148
        
149
        {section name=i loop=$view.video_responses}
150
            <div class="video-response">
151
                <a href="{$base_url}/view/{$view.video_responses[i].video_id}/{$view.video_responses[i].video_seo_name}/" title="{$view.video_responses[i].video_title}">
152
                    <img class="preview" src="{$view.video_responses[i].video_thumb_url}/thumb/{$view.video_responses[i].video_folder}1_{$view.video_responses[i].video_id}.jpg" width="80px" height="60" alt="{$view.video_responses[i].video_title}" />
153
                    <br />
154
                    {$view.video_responses[i].video_title|truncate:20}
155
                </a>
156
                <br />
157
                {$view.video_responses[i].video_view_number} views
158
                <br />
159
                {insert name=id_to_name assign=uname un=$view.video_responses[i].video_user_id}
160
                <a href="{$base_url}/{$uname}">{$uname}</a>
161
                <br />
162
            </div>
163
        {sectionelse}
164
            <center><p>Be the first to post a video response!</p></center>
165
        {/section}
166
    </div>
167
    
127 168
    <div class="section">
128 169
    
129 170
        <div class="hd">
b/upload_video_response.php
1
<?php
2
/******************************************************************************
3
 *
4
 * COMPANY: BuyScripts.in
5
 * PROJECT: vShare Youtube Clone
6
 * VERSION: [VSHARE_VERSION]
7
 * LISENSE: http://buyscripts.in/vshare-license.html
8
 * WEBSITE: http://buyscripts.in/youtube_clone.html
9
 *
10
 * This program is a commercial software and any kind of using it must agree
11
 * to vShare license.
12
 *
13
 ******************************************************************************/
14

  
15
require 'include/config.php';
16
require 'include/settings/upload.php';
17
require 'include/functions_upload.php';
18
require 'include/class.mail.php';
19
require 'include/language/' . LANG . '/lang_video_response.php';
20

  
21
User::is_logged_in();
22

  
23
$video_response_added = 0;
24

  
25
$sql = "SELECT * FROM `videos` WHERE
26
       `video_id`='" . (int) $_GET['vid'] . "' AND
27
       `video_active`='1' AND
28
       `video_approve`='1'";
29
$result = mysql_query($sql) or mysql_die($sql);
30

  
31
if (mysql_num_rows($result) == 0)
32
{
33
    redirect(VSHARE_URL . '/index.php');
34
}
35

  
36
$video_info = mysql_fetch_assoc($result);
37
$video_info['video_thumb_url'] = $servers[$video_info['video_thumb_server_id']];
38
$smarty->assign('video_info', $video_info);
39

  
40
if (isset($_POST['submit']))
41
{
42
    $sql = "DELETE FROM `video_responses` WHERE
43
           `video_response_video_id`='" . (int) $_POST['video_response_video_id'] . "'";
44
    mysql_query($sql) or mysql_die($sql);
45
    
46
    $sql = "INSERT INTO `video_responses` SET
47
           `video_response_video_id`='" . (int) $_POST['video_response_video_id'] . "',
48
           `video_response_to_video_id`='" . (int) $_POST['video_response_to_video_id'] . "',
49
           `video_response_add_time`='" . (int) $_SERVER['REQUEST_TIME'] . "'";
50
    mysql_query($sql) or mysql_die($sql);
51
    
52
    $sql = "SELECT `video_id`,`video_title`,`video_seo_name` FROM `videos` WHERE
53
           `video_id`='" . (int) $_POST['video_response_video_id'] . "'";
54
    $result = mysql_query($sql) or mysql_die($sql);
55
    $response_video_info = mysql_fetch_assoc($result);
56
    
57
    $data1 = 'VIDEO_RESPONSE' . $response_video_info['video_id'];
58
    $data2 = $video_info['video_id'];
59
    
60
    $vkey = $_SERVER['REQUEST_TIME'] . rand(1, 99999999);
61
    $vkey = md5($vkey);
62
    
63
    $sql = "INSERT INTO `verify_code` SET
64
           `vkey`='" . mysql_clean($vkey) . "',
65
           `data1`='" . mysql_clean($data1) . "',
66
           `data2`='" . (int) $data2 . "'";
67
    $result = mysql_query($sql) or mysql_die($sql);
68
    $verify_id = mysql_insert_id();
69
    
70
    $sql = "SELECT * FROM `email_templates` WHERE
71
           `email_id`='video_response_notify'";
72
    $result = mysql_query($sql) or mysql_die($sql);
73
    $tmp = mysql_fetch_assoc($result);
74
    $email_subject = $tmp['email_subject'];
75
    $email_body_tmp = $tmp['email_body'];
76
    
77
    $email_subject = str_replace('[SITE_NAME]', $config['site_name'], $email_subject);
78
    $email_subject = str_replace('[VIDEO_TITLE]', $video_info['video_title'], $email_subject);
79
    
80
    $video_url = VSHARE_URL . '/view/' . $video_info['video_id'] . '/' . $video_info['video_seo_name'] . '/';
81
    $response_video_url = VSHARE_URL . '/view/' . $response_video_info['video_id'] . '/' . $response_video_info['video_seo_name'] . '/';
82
    $verify_link = VSHARE_URL . '/verify/response/' . $response_video_info['video_id'] . '/' . $verify_id . '/' . $vkey . '/';
83
    
84
    $email_body_tmp = str_replace('[SITE_NAME]', $config['site_name'], $email_body_tmp);
85
    $email_body_tmp = str_replace('[SITE_URL]', VSHARE_URL, $email_body_tmp);
86
    $email_body_tmp = str_replace('[USERNAME]', $_SESSION['USERNAME'], $email_body_tmp);
87
    $email_body_tmp = str_replace('[VIDEO_URL]', $video_url, $email_body_tmp);
88
    $email_body_tmp = str_replace('[VIDEO_TITLE]', $video_info['video_title'], $email_body_tmp);
89
    $email_body_tmp = str_replace('[RESPONSE_VIDEO_URL]', $response_video_url, $email_body_tmp);
90
    $email_body_tmp = str_replace('[RESPONSE_VIDEO_TITLE]', $response_video_info['video_title'], $email_body_tmp);
91
    $email_body_tmp = str_replace('[VERIFY_LINK]', $verify_link, $email_body_tmp);
92
    
93
    $sql = "SELECT `user_name`,`user_email` FROM `users` WHERE
94
           `user_id`='" . $video_info['video_user_id'] . "'";
95
    $result = mysql_query($sql) or mysql_die($sql);
96
    $video_owner_info = mysql_fetch_assoc($result);
97
    
98
    $headers = "From: $config[site_name] <$config[admin_email]> \n";
99
    $headers .= "Content-Type: text/html\n";
100
    
101
    $email = array();
102
    $email['from_email'] = $config['admin_email'];
103
    $email['from_name'] = $config['site_name'];
104
    $email['to_email'] = $video_owner_info['user_email'];
105
    $email['to_name'] = $video_owner_info['user_name'];
106
    $email['subject'] = $email_subject;
107
    $email['body'] = $email_body_tmp;
108
    $mail = new Mail();
109
    $mail->send($email);
110
    
111
    $video_response_added = 1;
112
}
113

  
114
if ($video_response_added == 0)
115
{
116
    $sql = "SELECT * FROM `videos` WHERE
117
           `video_id`!='" . (int) $_GET['vid'] . "' AND
118
           `video_user_id`='" . (int) $_SESSION['UID'] . "' AND
119
           `video_active`='1' AND
120
           `video_approve`='1'
121
            ORDER BY `video_id` DESC";
122
    $result = mysql_query($sql) or mysql_die($sql);
123
    
124
    if (mysql_num_rows($result) > 0)
125
    {
126
        while ($video = mysql_fetch_assoc($result))
127
        {
128
            $video['video_already_response'] = 0;
129
            
130
            $sql = "SELECT * FROM `video_responses` WHERE
131
                  `video_response_video_id`='" . (int) $video['video_id'] . "'";
132
            $tmp = mysql_query($sql) or mysql_die($sql);
133
            
134
            $duplicate_video = 0;
135
            
136
            if (mysql_num_rows($tmp) > 0)
137
            {
138
                while ($tmp_info = mysql_fetch_assoc($tmp))
139
                {
140
                    if ($tmp_info['video_response_video_id'] == $video['video_id'])
141
                    {
142
                        $video['video_already_response'] = 1;
143
                    }
144
                    
145
                    if ($tmp_info['video_response_to_video_id'] == $_GET['vid'])
146
                    {
147
                        $duplicate_video = 1;
148
                    }
149
                }
150
            }
151
            
152
            if ($duplicate_video == 0)
153
            {
154
                $video['video_thumb_url'] = $servers[$video['video_thumb_server_id']];
155
                $user_videos[] = $video;
156
            }
157
        }
158
        
159
        $smarty->assign('user_videos', $user_videos);
160
    }
161
}
162

  
163
$smarty->assign('video_response_added', $video_response_added);
164
$smarty->assign('err', $err);
165
$smarty->assign('msg', $msg);
166
$smarty->display('header.tpl');
167
$smarty->display('upload_video_response.tpl');
168
$smarty->display('footer.tpl');
169
db_close();
b/video_response_verify.php
1
<?php
2
/******************************************************************************
3
 *
4
 * COMPANY: BuyScripts.in
5
 * PROJECT: vShare Youtube Clone
6
 * VERSION: [VSHARE_VERSION]
7
 * LISENSE: http://buyscripts.in/vshare-license.html
8
 * WEBSITE: http://buyscripts.in/youtube_clone.html
9
 *
10
 * This program is a commercial software and any kind of using it must agree
11
 * to vShare license.
12
 *
13
 ******************************************************************************/
14

  
15
require 'include/config.php';
16
require 'include/language/' . LANG . '/lang_video_response.php';
17

  
18
if (isset($_GET['k']) && isset($_GET['u']) && isset($_GET['i']))
19
{
20
    if (! is_numeric($_GET['u']))
21
    {
22
        $err = $lang['invalid_vcode'];
23
    }
24
    else if (! is_numeric($_GET['i']))
25
    {
26
        $err = $lang['invalid_vcode'];
27
    }
28
    else if (strlen($_GET['k']) > 40)
29
    {
30
        $err = $lang['invalid_vcode'];
31
    }
32
    else
33
    {
34
        $data1 = 'VIDEO_RESPONSE' . $_GET['u'];
35
        $sql = "SELECT * FROM `verify_code` WHERE
36
               `id`=" . (int) $_GET['i'] . " AND
37
               `vkey`='" . mysql_clean($_GET['k']) . "' AND
38
               `data1`='" . mysql_clean($data1) . "'";
39
        $result = mysql_query($sql) or mysql_die($sql);
40
        
41
        if (mysql_num_rows($result) == 0)
42
        {
43
            set_message($lang['invalid_vcode'], 'error');
44
            redirect(VSHARE_URL . '/index.php');
45
        }
46
        
47
        $vinfo = mysql_fetch_assoc($result);
48
        
49
        $sql = "SELECT * FROM `videos` WHERE
50
               `video_id`='" . (int) $_GET['u'] . "'";
51
        $result = mysql_query($sql) or mysql_die($sql);
52
        $video_info = mysql_fetch_assoc($result);
53
        $video_info['video_thumb_url'] = $servers[$video_info['video_thumb_server_id']];
54
        $smarty->assign('video_info', $video_info);
55
        
56
       if (isset($_POST['action']))
57
       {
58
            if ($_POST['action'] == 'Accept this video')
59
            {
60
                $sql = "UPDATE `video_responses` SET
61
                       `video_response_active`='1' WHERE
62
                       `video_response_video_id`='" . (int) $_GET['u'] . "' AND
63
                       `video_response_to_video_id`='" . (int) $vinfo['data2'] . "'";
64
                mysql_query($sql) or mysql_die($sql);
65
                
66
                $sql = "DELETE FROM `verify_code` WHERE
67
                       `id`='" . (int) $_GET['i'] . "' AND
68
                       `vkey`='" . mysql_clean($_GET['k']) . "' AND
69
                       `data1`='" . mysql_clean($data1) . "'";
70
                mysql_query($sql) or mysql_die($sql);
71
                
72
                set_message($lang['video_response_activated'], 'success');
73
                $redirect_url = VSHARE_URL . '/response/' . $vinfo['data2'] . '/videos/1';
74
                redirect($redirect_url);
75
            }
76
            else if ($_POST['action'] == 'Reject this video')
77
            {
78
                $sql = "DELETE FROM `verify_code` WHERE
79
                       `id`='" . (int) $_GET['i'] . "' AND
80
                       `vkey`='" . mysql_clean($_GET['k']) . "' AND
81
                       `data1`='" . mysql_clean($data1) . "'";
82
                mysql_query($sql) or mysql_die($sql);
83
                
84
                $sql = "DELETE FROM `video_responses` WHERE
85
                       `video_response_video_id`='" . (int) $_GET['u'] . "' AND
86
                       `video_response_to_video_id`='" . (int) $vinfo['data2'] . "'";
87
                mysql_query($sql) or mysql_die($sql);
88
                
89
                set_message($lang['video_response_rejected'], 'success');
90
                $redirect_url = VSHARE_URL . '/response/' . $vinfo['data2'] . '/videos/1';
91
                redirect($redirect_url);
92
            }
93
       }
94
    }
95
}
96

  
97
$smarty->assign('err', $err);
98
$smarty->display('header.tpl');
99
$smarty->display('video_response_verify.tpl');
100
$smarty->display('footer.tpl');
101
db_close();
b/video_responses.php
1
<?php
2
/******************************************************************************
3
 *
4
 * COMPANY: BuyScripts.in
5
 * PROJECT: vShare Youtube Clone
6
 * VERSION: [VSHARE_VERSION]
7
 * LISENSE: http://buyscripts.in/vshare-license.html
8
 * WEBSITE: http://buyscripts.in/youtube_clone.html
9
 *
10
 * This program is a commercial software and any kind of using it must agree
11
 * to vShare license.
12
 *
13
 ******************************************************************************/
14

  
15
require 'include/config.php';
16
require 'include/class.video.php';
17
require 'include/class.cache.php';
18
require 'include/language/' . LANG . '/lang_video_response.php';
19

  
20
$video_id = isset($_GET['video_id']) ? $_GET['video_id'] : '';
21

  
22
if (! is_numeric($video_id))
23
{
24
    redirect(VSHARE_URL);
25
}
26

  
27
Cache::init();
28

  
29
$page = (isset($_GET['page'])) ? (int) $_GET['page'] : 1;
30

  
31
if ($page < 1)
32
{
33
    $page = 1;
34
}
35

  
36
if (isset($_POST['remove_video']))
37
{
38
    User::is_logged_in();
39
    
40
    if (is_numeric($_POST['response_video_id']))
41
    {
42
        $sql = "DELETE FROM `video_responses` WHERE
43
               `video_response_video_id`='" . (int) $_POST['response_video_id'] . "' AND
44
               `video_response_to_video_id`='" . (int) $video_id . "'";
45
        mysql_query($sql) or mysql_die($sql);
46
        
47
        set_message($lang['video_removed'], 'success');
48
        
49
        $redirect_url = VSHARE_URL . '/response/' . $video_id . '/videos/' . $page;
50
        redirect($redirect_url);
51
    }
52
}
53

  
54
$cache_id = 'video_response' . $video_id . $page;
55

  
56
$view = Cache::load($cache_id);
57

  
58
if (! $view)
59
{
60
    $view = array();
61
    
62
    $video_info = Video::get_video_info($video_id);
63
    $video_info['video_thumb_url'] = $servers[$video_info['video_thumb_server_id']];
64
    $view['video_info'] = $video_info;
65
    
66
    $sql = "SELECT count(*) AS `total` FROM `video_responses` WHERE
67
           `video_response_to_video_id`='" . (int) $video_id . "' AND
68
           `video_response_active`='1'";
69
    $result = mysql_query($sql) or mysql_die($sql);
70
    $total = mysql_fetch_assoc($result);
71
    $view['total'] = $total['total'];
72
    
73
    $start_from = ($page - 1) * $config['num_watch_videos'];
74
    
75
    $sql = "SELECT v.* FROM `video_responses` AS `vr`,`videos` AS `v` WHERE
76
            vr.video_response_to_video_id='" . (int) $video_id . "' AND
77
            vr.video_response_active='1' AND
78
            vr.video_response_video_id=v.video_id
79
            ORDER BY vr.video_response_add_time DESC
80
            LIMIT $start_from, $config[num_watch_videos]";
81
    $result = mysql_query($sql) or mysql_die($sql);
82
    $video_count = mysql_num_rows($result);
83
    
84
    if ($video_count > 0)
85
    {
86
        while ($video = mysql_fetch_assoc($result))
87
        {
88
            $video['video_thumb_url'] = $servers[$video['video_thumb_server_id']];
89
            $videos[] = $video;
90
        }
91
        
92
        $view['start_num'] = $start_from + 1;
93
        $view['end_num'] = $start_from + $video_count;
94
        $view['page'] = $page;
95
        $view['page_links'] = paginate($view['total'], $config['num_watch_videos'], '.', '', $page);
96
        $view['videos'] = $videos;
97
    }
98
}
99

  
100
$smarty->assign('view', $view);
101
$smarty->assign('err', $err);
102
$smarty->assign('msg', $msg);
103
$smarty->display('header.tpl');
104
$smarty->display('video_responses.tpl');
105
$smarty->display('footer.tpl');
106
db_close();
b/view_video.php
180 180
        $tags = explode(' ', $video_info['video_keywords']);
181 181
        $view['tags'] = $tags;
182 182
        
183
        # Response Videos Start
184
        $view['video_responses'] = Video::get_response_videos($video_id, '5');
185
        
183 186
        # Related Videos Start
184 187
        
185 188

  
186
- 
b/templates/view_video.tpl
12 12
    
13 13
    {insert name=advertise adv_name='player_bottom'}
14 14
    
15
    {if $view.video_info.video_response_id gt '0'}
16
    <div id="videos-details">
17
        {insert name=getfield assign=response_title table='videos' field='video_title' qfield='video_id' qvalue=$view.video_info.video_response_id}
18
        {insert name=getfield assign=response_seo_name table='videos' field='video_seo_name' qfield='video_id' qvalue=$view.video_info.video_response_id}
19
        This is a video response to <a href="{$base_url}/view/{$view.video_info.video_response_id}/{$response_seo_name}/">{$response_title}</a>
20
    </div>
21
    {/if}
15
    {if $view.owner_video_info ne ''}
16
	<div id="videos-details">
17
	    <label>This is a video response to <a href="{$base_url}/view/{$view.owner_video_info.video_id}/{$view.owner_video_info.video_seo_name}/">{$view.owner_video_info.video_title}</a></label>
18
	</div>
19
	{/if}
22 20
        
23 21
    <div align="center">
24 22
        <a href="javascript:void(0);" title="FaceBook"><img src="{$img_css_url}/images/facebook.jpg" border="0" alt="facebook" onclick="window.open('http://www.facebook.com/share.php?u={$base_url}/view/{$view.video_info.video_id}/{$view.video_info.video_seo_name}/&amp;t={$view.video_info.video_title}','facebook', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=750,height=400,left = 0,top = 0');"/></a>&nbsp;
b/view_video.php
261 261
            }
262 262
        }
263 263
        
264
        $sql = "SELECT v.* FROM `videos` AS `v`,`video_responses` AS `vr` WHERE
265
                vr.video_response_video_id='" . (int) $video_id . "' AND
266
                vr.video_response_to_video_id=v.video_id";
267
        $result = mysql_query($sql) or mysql_die($sql);
268
        
269
        if (mysql_num_rows($result) > 0)
270
        {
271
            $owner_video_info = mysql_fetch_assoc($result);
272
            $view['owner_video_info'] = $owner_video_info;
273
        }
274
        
264 275
        $sql = "SELECT `user_name`,`user_website` FROM `users` WHERE
265 276
               `user_id`='" . (int) $video_info['video_user_id'] . "'";
266 277
        $result = mysql_query($sql) or mysql_die($sql);
267
- 
b/.htaccess
68 68
RewriteRule ^search/(.*)/(.*)/(.*)/(.*)/(.*)/(.*) advanced_search.php?words=$1&channels=$2&user=$3&relevence=$4&sort=$5&page=$6
69 69
RewriteRule ^style/(.*)/ style.php?css=$1 [L,QSA]
70 70
RewriteRule ^privacy/ user_privacy.php [L,QSA]
71
RewriteRule ^video_response_upload/(.*) upload_video_response.php?vid=$1 [L,QSA]
71 72
RewriteRule ^response/(.*)/videos/(.*) video_responses.php?video_id=$1&page=$2 [L,QSA]
72 73
RewriteRule ^verify/response/(.*)/(.*)/(.*)/ video_response_verify.php?u=$1&i=$2&k=$3
73 74
RewriteRule ^([^/\.]+)/favorites/(.*) user_favorites.php?user_name=$1&page=$2
b/templates/view_video.tpl
141 141
                {/if}
142 142
            </div>
143 143
            
144
            <div class="hd-r"><a href="{$base_url}/upload_video_response.php?vid={$view.video_info.video_id}">Post Video Response</a></div>
144
            <div class="hd-r"><a href="{$base_url}/video_response_upload/{$view.video_info.video_id}">Post Video Response</a></div>
145 145
        </div>
146 146
        
147 147
        {section name=i loop=$view.video_responses}
148
- 
b/templates/upload_video_response.tpl
49 49
    {if $video_response_added eq '0'}
50 50
    <div class="video-info" style="float: right;">
51 51
        {if $user_videos|@count gt '0'}
52
            <form method="post" action="?vid={$video_info.video_id}">
52
            <form method="post" action="">
53 53
           <select name="video_response_video_id" class="video-options" multiple="multiple">
54 54
               {section name=i loop=$user_videos}
55 55
                   <option value="{$user_videos[i].video_id}">
56
-