Update : pages.class.php
Added : New Video Search Engine Beta for Admin Fixed : Embed Upload Mod
This commit is contained in:
parent
9ef180245a
commit
cd974b3370
8 changed files with 151 additions and 218 deletions
|
@ -2,66 +2,29 @@
|
|||
<span class="page_title">Video Manager</span>
|
||||
|
||||
|
||||
<div class="search_box"> <form id="form1" name="form1" method="post" action="" class="video_search">
|
||||
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td> <label>Video Title
|
||||
<br />
|
||||
<input type="text" name="title" id="title" class="input" />
|
||||
<br />
|
||||
</label>
|
||||
From Date<br />
|
||||
<label>
|
||||
<input type="text" name="textfield" id="textfield" class="input" />
|
||||
</label>
|
||||
<br />
|
||||
Date To<br />
|
||||
<label>
|
||||
<input type="text" name="textfield2" id="textfield2" class="input" />
|
||||
</label>
|
||||
<br />
|
||||
<br /> <br /></td>
|
||||
<td valign="top"><label>Video Tags<br />
|
||||
<input type="text" name="tags" id="tags" class="input" />
|
||||
</label> <br /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Featured Only
|
||||
<label>
|
||||
<input type="checkbox" name="checkbox" id="checkbox" />
|
||||
</label>
|
||||
<br />
|
||||
Boradcast Type <label>
|
||||
<input name="broadcast" type="radio" id="radio" value="radio" checked="checked" />
|
||||
Public
|
||||
</label>
|
||||
<input type="radio" name="broadcast" id="radio2" value="radio" />
|
||||
Private<br />
|
||||
Comment Option
|
||||
<input name="comments" type="radio" id="radio3" value="radio" checked="checked" />
|
||||
Allowed
|
||||
<input type="radio" name="comments" id="radio4" value="radio" />
|
||||
Not Allowed<br />
|
||||
Embedding Option
|
||||
<input name="embedding" type="radio" id="radio5" value="radio" checked="checked" />
|
||||
Allowed
|
||||
<input type="radio" name="embedding" id="radio6" value="radio" />
|
||||
Not Allowed</td>
|
||||
<td valign="top">Rating From Rating To<br />
|
||||
Views From Views To<br />
|
||||
Comments From Comments To<br />
|
||||
Favorites From Favorites To</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Creation Date<br />
|
||||
Location<br />
|
||||
Country<br /></td>
|
||||
<td valign="top">Category</td>
|
||||
</tr>
|
||||
<div class="search_box"> <form id="video_search" name="video_search" method="get" action="video_manager.php" class="video_search">
|
||||
<table width="400" border="0" cellpadding="2" cellspacing="2">
|
||||
<tr>
|
||||
<td width="106" align="right"><label for="title">Video Title</label></td>
|
||||
<td width="280"><input name="title" type="text" class="input" id="title" value="{$smarty.get.title|form_val}" //></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><label for="videokey">Video Key</label></td>
|
||||
<td><input name="videokey" type="text" class="input" id="videokey" value="{$smarty.get.videokey|form_val}" //></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><label for="videoid">Video Id</label></td>
|
||||
<td><input name="videoid" type="text" class="input" id="videoid" value="{$smarty.get.videoid|form_val}" //></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right"><label for="tags">Video Tags</label></td>
|
||||
<td><input name="tags" type="text" class="input" id="tags" value="{$smarty.get.tags|form_val}" //></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form></div>
|
||||
<br />
|
||||
<input type="submit" name="search" id="search" value="Search Form" class="button"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- DIsplaying Videos -->
|
||||
|
|
|
@ -108,164 +108,64 @@ if(isset($_POST['delete_selected'])){
|
|||
}
|
||||
$msg = $LANG['vdo_del_selected'];
|
||||
}
|
||||
|
||||
//Assigning Default Values
|
||||
@$values_search= array(
|
||||
'search_uname' => mysql_clean($_GET['username']),
|
||||
'search_flagged' => mysql_clean($_GET['flagged']),
|
||||
'search_tags' => mysql_clean($_GET['tags']),
|
||||
'search_category' => mysql_clean($_GET['category']),
|
||||
'search_title' => mysql_clean($_GET['title']),
|
||||
'search_active' => mysql_clean($_GET['active']),
|
||||
'search_featured' => mysql_clean($_GET['featured']),
|
||||
'search_sort' => mysql_clean($_GET['sort']),
|
||||
'search_order' => mysql_clean($_GET['order'])
|
||||
);
|
||||
while(list($name,$value) = each($values_search)){
|
||||
DoTemplate::assign($name,$value);
|
||||
|
||||
//Jump To The page
|
||||
if(isset($_POST['display_page'])){
|
||||
redirect_to($_POST['page_number']);
|
||||
}
|
||||
|
||||
|
||||
//Jump To The page
|
||||
if(isset($_POST['display_page'])){
|
||||
redirect_to($_POST['page_number']);
|
||||
}
|
||||
|
||||
//Pagination
|
||||
|
||||
$limit = RESULTS;
|
||||
Assign('limit',$limit);
|
||||
$page = clean(@$_GET['page']);
|
||||
Assign('limit',$limit);
|
||||
if(empty($page) || $page == 0){
|
||||
$page = 1;
|
||||
//Using Form
|
||||
$cond = '';
|
||||
$cond_array = array();
|
||||
if(isset($_GET['search']))
|
||||
{
|
||||
//Valid Search Fields
|
||||
$valid_search_fields = array
|
||||
('videoid' => array('LIKE','%{VAR}%','AND'),
|
||||
'title' => array('LIKE','%{VAR}%','AND'),
|
||||
'videokey' => array('LIKE','%{VAR}%','AND'),
|
||||
'tags' => array('LIKE','%{VAR}%','AND'),
|
||||
);
|
||||
|
||||
foreach($valid_search_fields as $field => $field_props)
|
||||
{
|
||||
if(!empty($_GET[$field]))
|
||||
{
|
||||
if(empty($field_props[0]))
|
||||
$field_props[0] = '=';
|
||||
if(empty($field_props[1]))
|
||||
$field_props[1] = '{VAR}';
|
||||
if(empty($field_props[2]))
|
||||
$field_props[2] = 'OR';
|
||||
|
||||
$query_val = $field_props[1];
|
||||
$query_val = preg_replace('/{VAR}/',mysql_clean($_GET[$field]),$query_val);
|
||||
$cond_array[] = $field_props[2]." $field ".$field_props[0]." '".$query_val."' ";
|
||||
}
|
||||
}
|
||||
|
||||
//Creating Condition
|
||||
$count = 0;
|
||||
$cond = " videoid<>'0' ";
|
||||
foreach($cond_array as $qcond)
|
||||
{
|
||||
$cond .= $qcond;
|
||||
}
|
||||
}
|
||||
$from = $page-1;
|
||||
$from = $from*$limit;
|
||||
|
||||
$query_limit = "limit $from,$limit";
|
||||
$order = "ORDER BY date_added DESC";
|
||||
$sql = "SELECT * from video $order $query_limit";
|
||||
$sql_p = "SELECT * from video";
|
||||
|
||||
//Search
|
||||
if(isset($_GET['search'])){
|
||||
$username = mysql_clean($_GET['username']);
|
||||
$title = mysql_clean($_GET['title']);
|
||||
$flagged = mysql_clean($_GET['flagged']);
|
||||
$featured = mysql_clean($_GET['featured']);
|
||||
$active = mysql_clean($_GET['active']);
|
||||
$featured = mysql_clean($_GET['featured']);
|
||||
$tags = mysql_clean($_GET['tags']);
|
||||
$category = mysql_clean($_GET['category']);
|
||||
$sort = mysql_clean($_GET['sort']);
|
||||
$order = mysql_clean($_GET['order']);
|
||||
|
||||
if($order == 'ASC'){
|
||||
if($sort == 'username'){ $orderby = 'ORDER BY username ASC';}
|
||||
if($sort == 'title'){ $orderby = 'ORDER BY title ASC';}
|
||||
if($sort == 'date_added'){ $orderby = 'ORDER BY date_added ASC';}
|
||||
if($sort == 'views'){ $orderby = 'ORDER BY views ASC';}
|
||||
if($sort == 'rating'){ $orderby = 'ORDER BY rating ASC';}
|
||||
}else{
|
||||
if($sort == 'username'){ $orderby = 'ORDER BY username DESC';}
|
||||
if($sort == 'title'){ $orderby = 'ORDER BY title DESC';}
|
||||
if($sort == 'date_added'){ $orderby = 'ORDER BY date_added DESC';}
|
||||
if($sort == 'views'){ $orderby = 'ORDER BY views DESC';}
|
||||
if($sort == 'rating'){ $orderby = 'ORDER BY rating DESC';}
|
||||
}
|
||||
//Getting Video List
|
||||
$page = $_GET['page'];
|
||||
$get_limit = create_query_limit($page,RESULTS);
|
||||
$videos = $db->select("video",'*',$cond,$get_limit,"date_added DESC");
|
||||
Assign('videos', $videos);
|
||||
|
||||
$category = "AND
|
||||
(
|
||||
category01 = '".$category."' OR
|
||||
category02 = '".$category."' OR
|
||||
category03 = '".$category."'
|
||||
)
|
||||
";
|
||||
|
||||
if(!empty($flagged)){
|
||||
$query_flagged = "AND flagged = '".$flagged."'";
|
||||
}
|
||||
if(!empty($featured)){
|
||||
$query_featured = "AND featured = '".$featured."'";
|
||||
}
|
||||
if(!empty($active)){
|
||||
$query_active = "AND active = '".$active."'";
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * from video ";
|
||||
$sql .= "WHERE
|
||||
username like '%$username%' AND
|
||||
title like '%$title%'
|
||||
$query_flagged
|
||||
$query_featured
|
||||
$query_active AND
|
||||
tags like '%$tags%'
|
||||
$category $orderby $query_limit
|
||||
";
|
||||
|
||||
$sql_p = "SELECT * from video WHERE
|
||||
username like '%$username%' AND
|
||||
title like '%$title%'
|
||||
$query_flagged
|
||||
$query_featured
|
||||
$query_active
|
||||
AND tags like '%$tags%'
|
||||
$category ";
|
||||
}
|
||||
|
||||
//Assing User Data Values
|
||||
$rs = $db->Execute($sql);
|
||||
$total = $rs->recordcount() + 0;
|
||||
$videos = $rs->getrows();
|
||||
|
||||
for($id=0;$id<$total;$id++){
|
||||
$videos[$id]['thumb'] = substr($videos[$id]['flv'], 0, strrpos($videos[$id]['flv'], '.'));
|
||||
$videos[$id]['description'] = nl2br($videos[$id]['description']);
|
||||
$videos[$id]['category1'] = $myquery->GetCategory($videos[$id]['category01'],'category_name');
|
||||
$videos[$id]['category2'] = $myquery->GetCategory($videos[$id]['category02'],'category_name');
|
||||
$videos[$id]['category3'] = $myquery->GetCategory($videos[$id]['category03'],'category_name');
|
||||
}
|
||||
|
||||
Assign('total', $total + 0);
|
||||
Assign('videos', $videos);
|
||||
|
||||
//Pagination #A Tough Job#
|
||||
$view = clean(@$_GET['view']);
|
||||
if($view == 'search'){
|
||||
$link = '&username=' .mysql_clean($_GET['username']). '&title=' .mysql_clean($_GET['title']).'&flagged=' .mysql_clean($_GET['flagged']).'&featured=' .mysql_clean($_GET['featured']).'&active='.mysql_clean($_GET['active']).'&tags='.mysql_clean($_GET['tags']).'&category01='.mysql_clean($_GET['category01']).'&category02='.mysql_clean($_GET['category02']).'&category03='.mysql_clean($_GET['category03']).'&sort='.mysql_clean($_GET['sort']).'&order='.mysql_clean($_GET['order']).'&search='.mysql_clean($_GET['search']);
|
||||
Assign('link',$link);
|
||||
}
|
||||
|
||||
$query = mysql_query($sql_p);
|
||||
Assign('grand_total',mysql_num_rows($query));
|
||||
$total_rows = mysql_num_rows($query);
|
||||
$page_id=1;
|
||||
$id = 1;
|
||||
//$all_pages[0]['page'] = $page_id;
|
||||
$records = $total_rows/$limit;
|
||||
//Collecting Data for Pagination
|
||||
$total_rows = $db->count('video','*',$cond);
|
||||
$records = $total_rows/RESULTS;
|
||||
$total_pages = round($records+0.49,0);
|
||||
if(empty($link)){
|
||||
$link = "?view=Videos";
|
||||
}
|
||||
|
||||
$pages->paginate($total_pages,$page,$link);
|
||||
|
||||
|
||||
//Assigning Category List
|
||||
$sql = "SELECT * from category";
|
||||
$rs = $db->Execute($sql);
|
||||
$total_categories = $rs->recordcount() + 0;
|
||||
$category = $rs->getrows();
|
||||
Assign('category', $category);
|
||||
|
||||
Assign('msg', @$msg);
|
||||
/*Template('header.html');
|
||||
Template('leftmenu.html');
|
||||
Template('message.html');
|
||||
Template('video_manager.html');
|
||||
Template('footer.html');*/
|
||||
//Pagination
|
||||
$pages->paginate($total_pages,$page);
|
||||
|
||||
template_files('video_manager.html');
|
||||
display_it();
|
||||
|
|
|
@ -88,6 +88,16 @@ class ADODB_mysql extends ADOConnection {
|
|||
return dbselect($tbl,$fields,$cond,$limit,$order);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to count tables
|
||||
*/
|
||||
function count($tbl,$fields='*',$cond=false)
|
||||
{
|
||||
return dbcount($tbl,$fields,$cond);
|
||||
}
|
||||
|
||||
|
||||
function ADODB_mysql()
|
||||
{
|
||||
if (defined('ADODB_EXTENSION')) $this->rsPrefix .= 'ext_';
|
||||
|
|
|
@ -153,15 +153,22 @@ class pages{
|
|||
/**
|
||||
* Function used to create link
|
||||
*/
|
||||
function create_link($page,$link,$extra_params=NULL,$tag,$return_param=false)
|
||||
function create_link($page,$link=NULL,$extra_params=NULL,$tag,$return_param=false)
|
||||
{
|
||||
if($link==NULL or $link == 'auto')
|
||||
{
|
||||
if($_SERVER['QUERY_STRING'])
|
||||
$link = '?'.$_SERVER['QUERY_STRING'];
|
||||
}
|
||||
|
||||
$page_pattern = '#page#';
|
||||
$param_pattern = '#params#';
|
||||
$page_url_param = $this->url_page_var;
|
||||
$page_link_pattern = $page_url_param.'='.$page_pattern;
|
||||
|
||||
$link = preg_replace(array('/(\?page=[0-9+])+/','/(&page=[0-9+])+/','/(page=[0-9+])+/'),'',$link);
|
||||
|
||||
preg_match('/\?/',$link,$matches);
|
||||
|
||||
|
||||
if(!empty($matches[0]))
|
||||
{
|
||||
$page_link = '&'.$page_link_pattern;
|
||||
|
@ -191,9 +198,12 @@ class pages{
|
|||
* @param : extra paraments in the tag ie <a other_params_go_here
|
||||
* @param : tag used for pagination
|
||||
*/
|
||||
function pagination($total,$page,$link,$extra_params=NULL,$tag='<a #params#>#page#</a>')
|
||||
function pagination($total,$page,$link=NULL,$extra_params=NULL,$tag='<a #params#>#page#</a>')
|
||||
{
|
||||
|
||||
if($total==0)
|
||||
return false;
|
||||
if($page<=0||$page==''||!is_numeric($page))
|
||||
$page = 1;
|
||||
$total_pages = $total;
|
||||
$pagination_start = 10;
|
||||
$display_page = 7;
|
||||
|
@ -289,6 +299,20 @@ class pages{
|
|||
$pagination_smart .=$this->create_link($i,$link,$extra_params,$tag);
|
||||
}
|
||||
|
||||
|
||||
//Previous Page
|
||||
if($selected-1 > 1)
|
||||
$this->pre_link = $this->create_link($selected-1,$link,$extra_params,$tag,true);
|
||||
//Next Page
|
||||
if($selected+1 < $total)
|
||||
$this->next_link = $this->create_link($selected+1,$link,$extra_params,$tag,true);
|
||||
//First Page
|
||||
if($selected!=1)
|
||||
$this->first_link = $this->create_link(1,$link,$extra_params,$tag,true);
|
||||
//First Page
|
||||
if($selected!=$total)
|
||||
$this->last_link = $this->create_link($total,$link,$extra_params,$tag,true);
|
||||
|
||||
return $pagination_smart;
|
||||
}
|
||||
}
|
||||
|
@ -297,8 +321,9 @@ class pages{
|
|||
/**
|
||||
* Function used to create pagination and assign values that can bee used in template
|
||||
*/
|
||||
function paginate($total,$page,$link,$extra_params=NULL,$tag='<a #params#>#page#</a>')
|
||||
function paginate($total,$page,$link=NULL,$extra_params=NULL,$tag='<a #params#>#page#</a>')
|
||||
{
|
||||
|
||||
$this->pagination = $this->pagination($total,$page,$link,$extra_params,$tag);
|
||||
//Assigning Varaiable that can be used in templates
|
||||
assign('pagination',$this->pagination);
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
$req = $field['required'];
|
||||
$invalid_err = $field['invalid_err'];
|
||||
$function_error_msg = $field['function_error_msg'];
|
||||
if(is_string($val))
|
||||
$length = strlen($val);
|
||||
$min_len = $field['min_length'];
|
||||
$min_len = $min_len ? $min_len : 0;
|
||||
|
@ -194,7 +195,8 @@
|
|||
}
|
||||
$val = $new_val;
|
||||
}
|
||||
if(!$field['clean_func'] || (!function_exists($field['clean_func']) && !is_array($field['clean_func'])))
|
||||
|
||||
if(!$field['clean_func'] || (!apply_func($field['clean_func'],$val) && !is_array($field['clean_func'])))
|
||||
$val = mysql_clean($val);
|
||||
else
|
||||
$val = apply_func($field['clean_func'],$val);
|
||||
|
|
|
@ -1109,6 +1109,21 @@ function SetTime($sec, $padHours = true) {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function used to count fields in mysql
|
||||
* @param TABLE NAME
|
||||
* @param Fields
|
||||
* @param condition
|
||||
*/
|
||||
function dbcount($tbl,$fields='*',$cond=false)
|
||||
{
|
||||
global $db;
|
||||
if($cond)
|
||||
$condition = " Where $cond ";
|
||||
$query = "Select Count($fields) From $tbl $condition";
|
||||
$result = $db->Execute($query);
|
||||
return $result->fields[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* An easy function for erorrs and messages (e is basically short form of exception)
|
||||
|
@ -1994,4 +2009,21 @@ function SetTime($sec, $padHours = true) {
|
|||
global $cbplugin;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Function used to create limit functoin from current page & results
|
||||
*/
|
||||
function create_query_limit($page,$result)
|
||||
{
|
||||
$limit = $result;
|
||||
if(empty($page) || $page == 0 || !is_numeric($page)){
|
||||
$page = 1;
|
||||
}
|
||||
$from = $page-1;
|
||||
$from = $from*$limit;
|
||||
|
||||
return $from.','.$result;
|
||||
}
|
||||
?>
|
|
@ -231,6 +231,7 @@ if(!function_exists('validate_embed_code'))
|
|||
register_custom_upload_field($embed_field_array);
|
||||
$Cbucket->add_header(PLUG_DIR.'/embed_video_mod/header.html');
|
||||
register_actions_play_video('play_embed_video');
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -42,7 +42,7 @@ var imageurl = '{$imageurl}';
|
|||
|
||||
|
||||
<!-- Including Headers -->
|
||||
{foreach from=$Cbucket->header_files key=type item=file}
|
||||
{foreach from=$Cbucket->header_files key=file item=type}
|
||||
{if $curActive == $type || $type=='global' }
|
||||
{include file="$file"}
|
||||
{/if}
|
||||
|
|
Loading…
Add table
Reference in a new issue