From 946f1f390fcb71db9ffecef8922034babc724d85 Mon Sep 17 00:00:00 2001 From: Arslan Hassan Date: Tue, 9 Aug 2011 10:20:09 +0000 Subject: [PATCH] Fixed : news feed in admin panel Added : new video SEO URL option Added : custom video url option Added : direct view channel option --- upload/.htaccess | 16 ++++-- upload/admin_area/main.php | 1 + .../admin_area/styles/cbv2/layout/main.html | 54 ++++++++++++++----- upload/ajax.php | 4 +- upload/cb_install/sql/configs.sql | 6 +++ upload/cb_install/sql/structure.sql | 6 ++- upload/cb_install/sql/upgrade_2.6.sql | 3 +- upload/includes/functions.php | 51 +++++++++++++++++- upload/view_channel.php | 21 +++++++- 9 files changed, 137 insertions(+), 25 deletions(-) diff --git a/upload/.htaccess b/upload/.htaccess index cf630f77..602a5b35 100644 --- a/upload/.htaccess +++ b/upload/.htaccess @@ -41,6 +41,10 @@ RewriteRule ^videos/(.*)/(.*)/(.*)/(.*)/(.*) videos.php?cat=$1&sort=$3&time=$4&p RewriteRule ^videos/([0-9]+) videos.php?page=$1 [L] RewriteRule ^videos videos.php?%{QUERY_STRING} [L] RewriteRule ^video/(.*)/(.*) watch_video.php?v=$1&%{QUERY_STRING} [L] +#Alternate watch video links +RewriteRule ^(.*)\_v([0-9]+) watch_video.php?v=$2&%{QUERY_STRING} [L] +RewriteRule ^video/([0-9]+)_(.*) watch_video.php?v=$1&%{QUERY_STRING} [L] + # #Users, Channel & Management @@ -88,9 +92,9 @@ RewriteRule ^photos photos.php [L] RewriteRule ^collection/(.*)/(.*)/(.*) view_collection.php?cid=$1&type=$2&%{QUERY_STRING} [L] #Photo Section -RewriteRule ^item/(.*)/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L] -RewriteRule ^photo_upload/(.*) photo_upload.php?collection=$1 [L] -RewriteRule ^photo_upload photo_upload.php [L] +RewriteRule ^item/(.*)/(.*)/(.*)/(.*) view_item.php?item=$3&type=$1&collection=$2 [L] +RewriteRule ^photo_upload/(.*) photo_upload.php?collection=$1 [L] +RewriteRule ^photo_upload photo_upload.php [L] # RewriteRule ^sitemap.xml$ sitemap.php RewriteRule ^signup signup.php @@ -101,6 +105,8 @@ ErrorDocument 403 /403.php ########## End - Rewrite rules For SEO urls ###################### RewriteRule ^rss$ rss.php [nc] -RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING} [nc] +RewriteRule ^rss/([a-zA-Z0-9].+)$ rss.php?mode=$1&%{QUERY_STRING} [nc] -########## End - Rewrite rules For SEO urls ###################### \ No newline at end of file +########## End - Rewrite rules For SEO urls ###################### + +RewriteRule ^([a-zA-Z0-9-]+)/?$ view_channel.php?uid=$1&seo_diret=yes [NS] \ No newline at end of file diff --git a/upload/admin_area/main.php b/upload/admin_area/main.php index 53e641dd..a70ca2a7 100644 --- a/upload/admin_area/main.php +++ b/upload/admin_area/main.php @@ -167,6 +167,7 @@ if(isset($_POST['update'])){ 'srate', 'site_slogan', 'seo', + 'seo_vido_url', 'search_list_per_page', 'server_friendly_conversion', 'support_email', diff --git a/upload/admin_area/styles/cbv2/layout/main.html b/upload/admin_area/styles/cbv2/layout/main.html index 26ccf491..e4da1a26 100644 --- a/upload/admin_area/styles/cbv2/layout/main.html +++ b/upload/admin_area/styles/cbv2/layout/main.html @@ -378,6 +378,30 @@ $(document).ready(function(){ + + Seo video url pattern + + +
+ +
+ +
+ + +     @@ -467,22 +491,28 @@ $(document).ready(function(){ - Allow videos ratings - - - Allow user to rate own videos - + + Allow videos ratings + + - + + Allow user to rate own videos - Allow collection ratings - - - Allow user to rate own collections - + + Allow collection ratings + + - + + Allow user to rate own collections - Allow channel ratings - - - Allow users to rate own channels - + + Allow channel ratings + + - + + Allow users to rate own channels diff --git a/upload/ajax.php b/upload/ajax.php index 9676ff11..056d6de8 100644 --- a/upload/ajax.php +++ b/upload/ajax.php @@ -1429,8 +1429,8 @@ if(!empty($mode)) { echo '
'; echo '
- '.$n['title'].' - '.date("m-d-Y",time($n['pubDate'])).'
+ '.$n['title'].' + '.date("m-d-Y",strtotime($n['pubDate'])).'
'; echo '
'; echo $n['description']; diff --git a/upload/cb_install/sql/configs.sql b/upload/cb_install/sql/configs.sql index 99dd5529..f47eba99 100644 --- a/upload/cb_install/sql/configs.sql +++ b/upload/cb_install/sql/configs.sql @@ -226,6 +226,7 @@ INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL,'max_topic_title','300'); + INSERT INTO `{tbl_prefix}languages` (`language_id`, `language_code`, `language_name`, `language_regex`, `language_active`, `language_default`) VALUES (5, 'en', 'English', '/^en/i', 'yes', 'yes'); @@ -239,3 +240,8 @@ INSERT INTO `{tbl_prefix}validation_re` (`re_id`, `re_name`, `re_code`, `re_synt INSERT INTO `{tbl_prefix}config` (`configid` ,`name` ,`value`)VALUES (NULL , 'comments_per_page', '15'), (NULL, 'embed_type', 'iframe'); + +-- Addition for 2.6 +INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL, 'facebook_embed', 'yes'); +INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL, 'seo_vido_url', '1'); + diff --git a/upload/cb_install/sql/structure.sql b/upload/cb_install/sql/structure.sql index 5c682f4a..6c5b2943 100644 --- a/upload/cb_install/sql/structure.sql +++ b/upload/cb_install/sql/structure.sql @@ -1058,4 +1058,8 @@ ADD `display` ENUM( 'yes', 'no' ) NOT NULL DEFAULT 'yes' AFTER `page_order` ; ALTER TABLE `{tbl_prefix}users` ADD `voted` TEXT NOT NULL AFTER `last_commented`; -- Alterations for 2.5.5 -ALTER TABLE `{tbl_prefix}groups` ADD `group_admins` TEXT NOT NULL AFTER `userid`; \ No newline at end of file +ALTER TABLE `{tbl_prefix}groups` ADD `group_admins` TEXT NOT NULL AFTER `userid`; + +-- Alterations for 2.6 +ALTER TABLE `{tbl_prefix}video` CHANGE `category` `category` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0'; +ALTER TABLE `{tbl_prefix}collections` CHANGE `category` `category` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ; \ No newline at end of file diff --git a/upload/cb_install/sql/upgrade_2.6.sql b/upload/cb_install/sql/upgrade_2.6.sql index f4b54038..ac4d695a 100644 --- a/upload/cb_install/sql/upgrade_2.6.sql +++ b/upload/cb_install/sql/upgrade_2.6.sql @@ -1,3 +1,4 @@ ALTER TABLE `{tbl_prefix}video` CHANGE `category` `category` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '0'; ALTER TABLE `{tbl_prefix}collections` CHANGE `category` `category` VARCHAR( 200 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ; -INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL, 'facebook_embed', 'yes'); \ No newline at end of file +INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL, 'facebook_embed', 'yes'); +INSERT INTO `{tbl_prefix}config` (`configid`, `name`, `value`) VALUES (NULL, 'seo_vido_url', '0'); \ No newline at end of file diff --git a/upload/includes/functions.php b/upload/includes/functions.php index 298bbf17..fc2cc57e 100644 --- a/upload/includes/functions.php +++ b/upload/includes/functions.php @@ -108,7 +108,7 @@ { $id = stripslashes($id); } - $id = htmlspecialchars(mysql_real_escape_string($id), ENT_COMPAT, 'UTF-8'); + $id = htmlspecialchars(mysql_real_escape_string($id)); if($replacer) $id = Replacer($id); return $id; @@ -822,11 +822,58 @@ if(!empty($vid)) $vdetails = $myquery->get_video_details($vid); + //calling for custom video link functions + $functions = cb_get_functions('video_link'); + if($functions) + { + foreach($functions as $func) + { + $array = array('vdetails'=>$vdetails,'type'=>$type); + if(function_exists($func['func'])) + { + $returned = $func['func']($array); + if($returned) + { + $link = $returned; + return $link; + break; + } + } + } + } + $plist = ""; if(SEO == 'yes'){ + if($vdetails['playlist_id']) $plist = '?&play_list='.$vdetails['playlist_id']; - $link = BASEURL.'/video/'.$vdetails['videokey'].'/'.SEO(clean(str_replace(' ','-',$vdetails['title']))).$plist; + + switch(config('seo_vido_url')) + { + default: + $link = BASEURL.'/video/'.$vdetails['videokey'].'/'.SEO(clean(str_replace(' ','-',$vdetails['title']))).$plist; + break; + + case 1: + { + $link = BASEURL.'/'.SEO(clean(str_replace(' ','-',$vdetails['title']))).'_v'.$vdetails['videoid'].$plist; + } + break; + + case 2: + { + $link = BASEURL.'/video/'.$vdetails['videoid'].'/'.SEO(clean(str_replace(' ','-',$vdetails['title']))).$plist; + } + break; + + case 3: + { + $link = BASEURL.'/video/'.$vdetails['videoid'].'_'.SEO(clean(str_replace(' ','-',$vdetails['title']))).$plist; + } + break; + } + + }else{ if($vdetails['playlist_id']) $plist = '&play_list='.$vdetails['playlist_id']; diff --git a/upload/view_channel.php b/upload/view_channel.php index 22faebf0..5f4e5b5d 100644 --- a/upload/view_channel.php +++ b/upload/view_channel.php @@ -86,8 +86,25 @@ if($udetails) assign('profile_item',$profileItem); }else{ - e(lang("usr_exist_err")); - $Cbucket->show_page = false; + + if($_GET['seo_diret']!='yes') + { + e(lang("usr_exist_err")); + $Cbucket->show_page = false; + }else{ + header("HTTP/1.0 404 Not Found"); + if(file_exists(LAYOUT."/404.html")) { + template_files('404.html'); + } else { + $data = "404_error"; + if(has_access('admin_access')) + e(sprintf(lang("err_warning"),"404","http://docs.clip-bucket.com/?p=154"),"w"); + e(lang($data)); + } + + display_it(); + exit(); + } } add_js(array('jquery_plugs/compressed/jquery.jCarousel.js'=>'view_channel'));