-
Üyelik
27.04.2018
-
Yaş/Cinsiyet
37 / E
-
Meslek
market
-
Konum
Afyon
-
Ad Soyad
H** S**
-
Mesajlar
5
-
Beğeniler
2 / 0
-
Ticaret
0, (%0)
$yazdir = mysql_query("SELECT name FROM pm_categories where id order by id");
$name = $write['name'];
while($row = mysql_fetch_assoc($yazdir)){
$data[] = $row;
}
$smarty->assign('data', $data);
bu şekil yapınca da tüm veriyi çekiyor. Sayfadaki kodun hepsini aşağı ekliyorum. Yukarıdaki kod satır 595 de. istediğim şey bu sayfada kategori isimlerin değişken olarak listenlenmesi
session_start();
require('config.php');
require_once('include/functions.php');
require_once('include/user_functions.php');
require_once('include/islogged.php');
$page = (int) $_GET['page'];
if ( ! $page)
{
$page = 1;
}
$limit = $config['new_page_limit'];
$from = $page * $limit - ($limit);
$date = $_GET['d'];
$total_videos = 0;
if ( ! in_array($date, array('today', 'yesterday', 'month')))
{
$date = '';
}
// count total videos
switch ($date)
{
default:
$total_videos = $config['published_videos'];
$total_pages = ceil($total_videos / $limit);
if ($page == $total_pages || $total_pages == 0)
{
// recount published videos count
$count = count_entries('pm_videos', 'added <= '. $time_now_minute .' AND video_type', IS_VIDEO);
if ($config['published_videos'] != $count)
{
$total_videos = $count;
update_config('published_videos', $count);
}
}
break;
case 'today':
case 'yesterday':
case 'month':
switch ($date)
{
case 'today':
$time = getdate();
$time_start = mktime(0, 0, 0, $time['mon'], $time['mday'], $time['year']);
$time_end = mktime(23, 59, 59, $time['mon'], $time['mday'], $time['year']);
break;
case 'yesterday':
$time = getdate();
$time_start = mktime(0, 0, 0, $time['mon'], $time['mday'] - 1, $time['year']);
$time_end = mktime(23, 59, 59, $time['mon'], $time['mday'] - 1, $time['year']);
break;
case 'month':
$time = getdate();
$days_this_month = (int) date('t', mktime(0,0,0, $time['mon'], 1, $time['year']));
$time_start = mktime(0, 0, 0, $time['mon'], 1, $time['year']);
$time_end = mktime(23, 59, 59, $time['mon'], $days_this_month, $time['year']);
break;
}
$sql = "SELECT COUNT(*) as total_found
FROM pm_videos
WHERE added >= '". $time_start ."'
AND added <= '". $time_end ."'
AND video_type = ". IS_VIDEO;
$result = @mysql_query($sql);
if ( ! $result)
{
$total_videos = 0;
}
else
{
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
$total_videos = (int) $row['total_found'];
unset($row);
}
break;
}
if ($total_videos > 0)
{
switch ($date)
{
default:
$sql = "SELECT id
FROM pm_videos
WHERE added <= '". $time_now_minute ."'
AND video_type = ". IS_VIDEO ."
ORDER BY added DESC
LIMIT ". $from .",". $limit;
break;
case 'today':
case 'yesterday':
case 'month':
$sql = "SELECT id
FROM pm_videos
WHERE added >= '". $time_start ."'
AND added <= '". $time_end ."'
AND video_type = ". IS_VIDEO ."
ORDER BY added DESC
LIMIT ". $from .",". $limit;
break;
}
$result = mysql_query($sql);
$ids = array();
while ($row = mysql_fetch_assoc($result))
{
$ids[] = $row['id'];
}
mysql_free_result($result);
$list = get_video_list('added', 'DESC', 0, 0, 0, $ids);
}
$top_videos = top_videos($config['top_videos_sort'], _TOPVIDS);
$new_videos = get_video_list('added', 'desc', 0, _NEWVIDS);
$featured_videos = get_featured_video_list((int) $config['homepage_featured_limit']);
$total_featured_videos = pm_count($featured_videos);
// Get latest articles
if (_MOD_ARTICLE)
{
$articles = art_load_articles(0, $config['article_widget_limit']);
if ( ! array_key_exists('type', $articles))
{
foreach ($articles as $id => $article)
{
$articles[$id]['title'] = fewchars($article['title'], 55);
}
$smarty->assign('articles', $articles);
}
}
// generate smart pagination
$pagination = '';
if ($total_videos > $limit)
{
$filename = (_SEOMOD) ? 'newvideos.html' : 'newvideos.php';
$extra = '';
if ($date != '')
{
$extra = 'd='. $date;
}
$pagination = generate_smart_pagination($page, $total_videos, $limit, 1, $filename, $extra);
}
$top_videos = top_videos($config['top_videos_sort'], _TOPVIDS);
$new_videos = get_video_list('added', 'desc', 0, _NEWVIDS);
$featured_videos = get_featured_video_list((int) $config['homepage_featured_limit']);
$total_featured_videos = pm_count($featured_videos);
$cat_name = secure_sql($_GET['cat']);
$page = $_GET['page'];
$sortby = secure_sql($_GET['sortby']);
$order = secure_sql($_GET['order']);
if ( ! in_array($sortby, array('views', 'date', 'rating', 'title')))
{
$sortby = '';
}
if ( ! in_array($order, array('desc', 'asc', 'DESC', 'ASC')))
{
$order = '';
}
if($sortby == 'views') {
$sql_sortby = 'site_views';
$order = 'DESC';
}
elseif($sortby == 'date') {
$sql_sortby = 'added';
$order = 'DESC';
}
elseif($sortby == 'rating') {
$sql_sortby = 'total_value';
$order = 'DESC';
}
elseif($sortby == 'title') {
$sql_sortby = 'video_title';
$order = 'ASC';
}
// Default Page
if (empty($page) || !is_numeric($page) || $page < 0 ) { $page = 1 ; }
if(is_numeric($cat_id)){
$resync = 0;
$category = array();
$total_items = 0;
$categories = load_categories(array('db_table' => 'pm_categories'));
foreach ($categories as $c_id => $c)
{
if ($c_id == $cat_id)
{
$category = $c;
}
}
$total_items = $category['published_videos'];
if ($total_items < 10)
{
$resync = 1;
}
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit);
if ($total_items == 0)
{
$problem = $lang['browse_msg2'];
}
else
{
if (isset($sortby) && isset($order))
{
$sql_sortby = ($sql_sortby == '') ? "added" : $sql_sortby;
$order = ($order == '') ? "DESC" : $order;
}
if ($sortby == 'rating')
{
$sql = "SELECT pm_videos.uniq_id, COALESCE(pm_bin_rating_meta.score, 0) as score
FROM pm_videos
LEFT JOIN pm_bin_rating_meta ON (pm_videos.uniq_id = pm_bin_rating_meta.uniq_id)
WHERE added <= '". $time_now_minute ."'
AND (category LIKE '%,$cat_id,%'
OR category like '%,$cat_id'
OR category like '$cat_id,%'
OR category='$cat_id')
AND video_type = ". IS_VIDEO ."
ORDER BY score DESC
LIMIT $set_limit, $limit" ;
$result = mysql_query($sql);
$uniq_ids = array();
while ($row = mysql_fetch_array($result))
{
$uniq_ids[] = $row['uniq_id'];
}
mysql_free_result($result);
$videos = array();
$videos = get_video_list('', '', 0, $limit, 0, array(), $uniq_ids);
}
else
{
$videos = get_video_list($sql_sortby, $order, $set_limit, $limit, $cat_id);
}
if ($page == $total_pages && $total_items > 0 && $row_count == 0)
{
$resync = 1;
}
else if ($row_count == 0 && $page > 1 && $total_items > 0)
{
$resync = 1;
}
else if (($row_count + $set_limit > $total_items) && $total_items > 0)
{
$resync = 1;
}
else if (($row_count + $set_limit >= $total_items) && ($category['total_videos'] > $total_items))
{
$resync = 1;
}
else if (($row_count + $set_limit >= $category['published_videos']) && $page == $total_pages)
{
$resync = 1;
}
}
if ($resync)
{
$sql_t = "SELECT COUNT(*) as total FROM pm_videos WHERE (category LIKE '%,$cat_id,%' OR category LIKE '%,$cat_id' OR category LIKE '$cat_id,%' OR category='$cat_id') AND video_type = ". IS_VIDEO;
$result_t = @mysql_query($sql_t);
$row = @mysql_fetch_assoc($result_t);
$total_items = $row['total'];
@mysql_free_result($result_t);
@mysql_query("UPDATE pm_categories SET total_videos = '". $total_items ."' WHERE id = '". $cat_id ."'");
$sql_t = "SELECT COUNT(*) as total FROM pm_videos WHERE added <= '". time() ."' AND (category LIKE '%,$cat_id,%' OR category LIKE '%,$cat_id' OR category LIKE '$cat_id,%' OR category='$cat_id') AND video_type = ". IS_VIDEO;
$result_t = @mysql_query($sql_t);
$row = @mysql_fetch_assoc($result_t);
$total_items = $row['total'];
@mysql_free_result($result_t);
@mysql_query("UPDATE pm_categories SET published_videos = '". $total_items ."' WHERE id = '". $cat_id ."'");
}
}
// generate smart pagination
$pagination = '';
if ($total_items > $limit)
{
$append_url = '';
if ( ! _SEOMOD)
{
$append_url = '';
$filename = 'category.php';
if($cat_name != '') $append_url .= 'cat=' . $cat_name;
if($page != '') $append_url .= '&page=' . $page;
if($sortby != '') $append_url .= '&sortby=' . $sortby;
if($order != '') $append_url .= '&order=' . $order;
}
else
{
$filename = "browse-" . $cat_name . "-videos-" . $page . "-" . $sortby . ".html";
}
$pagination = generate_smart_pagination($page, $total_items, $limit, 1, $filename, $append_url, _SEOMOD);
}
$meta_title = $category['meta_title'];
if ($category['meta_title'] == '')
{
if($page != 1 && is_numeric($page))
{
$meta_title = $category_name." ".$lang['videos']." - ".sprintf($lang['page_number'], $page);
}
else
{
$meta_title = $category_name." ".$lang['videos'];
}
}
$meta_description = ($category['meta_description'] != '') ? $category['meta_description'] : $category_name." ".$lang['videos']." - "._SITENAME." - ". $page;
$meta_keywords = $category['meta_keywords'];
// define meta tags & common variables
$meta_title = $lang['nv_page_title'];
if(!empty($date)) {
$meta_title .= ' - '.$lang["added"].' '.$date;
}
if(!empty($page) && $page > 1) {
$meta_title .= ' - '.sprintf($lang['page_number'], $page);
}
$meta_title = sprintf($meta_title, _SITENAME);
$meta_description = $meta_title;
// end
// MAKE SORT BY STICK
if(!empty($cat_id)) {
$list_cats = list_categories(0, $cat_id);
$smarty->assign('list_categories', $list_cats);
} else {
$list_cats = list_categories(0, '');
$smarty->assign('list_categories', $list_cats);
}
if($config['show_tags'] == 1)
{
$tag_cloud = tag_cloud(0, $config['tag_cloud_limit'], $config['shuffle_tags']);
$smarty->assign('tags', $tag_cloud);
$smarty->assign('show_tags', 1);
}
if (empty($page) || !is_numeric($page) || $page < 0 ) { $page = 1 ; }
if(is_numeric($cat_id)){
$resync = 0;
$category = array();
$total_items = 0;
$categories = load_categories(array('db_table' => 'pm_categories'));
foreach ($categories as $c_id => $c)
{
if ($c_id == $cat_id)
{
$category = $c;
}
}
$total_items = $category['published_videos'];
if ($total_items < 10)
{
$resync = 1;
}
$total_pages = ceil($total_items / $limit);
$set_limit = $page * $limit - ($limit);
if ($total_items == 0)
{
$problem = $lang['browse_msg2'];
}
else
{
if (isset($sortby) && isset($order))
{
$sql_sortby = ($sql_sortby == '') ? "added" : $sql_sortby;
$order = ($order == '') ? "DESC" : $order;
}
if ($sortby == 'rating')
{
$sql = "SELECT pm_videos.uniq_id, COALESCE(pm_bin_rating_meta.score, 0) as score
FROM pm_videos
LEFT JOIN pm_bin_rating_meta ON (pm_videos.uniq_id = pm_bin_rating_meta.uniq_id)
WHERE added <= '". $time_now_minute ."'
AND (category LIKE '%,$cat_id,%'
OR category like '%,$cat_id'
OR category like '$cat_id,%'
OR category='$cat_id')
AND video_type = ". IS_VIDEO ."
ORDER BY score DESC
LIMIT $set_limit, $limit" ;
$result = mysql_query($sql);
$uniq_ids = array();
while ($row = mysql_fetch_array($result))
{
$uniq_ids[] = $row['uniq_id'];
}
mysql_free_result($result);
$videos = array();
$videos = get_video_list('', '', 0, $limit, 0, array(), $uniq_ids);
}
else
{
$videos = get_video_list($sql_sortby, $order, $set_limit, $limit, $cat_id);
}
if ($page == $total_pages && $total_items > 0 && $row_count == 0)
{
$resync = 1;
}
else if ($row_count == 0 && $page > 1 && $total_items > 0)
{
$resync = 1;
}
else if (($row_count + $set_limit > $total_items) && $total_items > 0)
{
$resync = 1;
}
else if (($row_count + $set_limit >= $total_items) && ($category['total_videos'] > $total_items))
{
$resync = 1;
}
else if (($row_count + $set_limit >= $category['published_videos']) && $page == $total_pages)
{
$resync = 1;
}
}
if ($resync)
{
$sql_t = "SELECT COUNT(*) as total FROM pm_videos WHERE (category LIKE '%,$cat_id,%' OR category LIKE '%,$cat_id' OR category LIKE '$cat_id,%' OR category='$cat_id') AND video_type = ". IS_VIDEO;
$result_t = @mysql_query($sql_t);
$row = @mysql_fetch_assoc($result_t);
$total_items = $row['total'];
@mysql_free_result($result_t);
@mysql_query("UPDATE pm_categories SET total_videos = '". $total_items ."' WHERE id = '". $cat_id ."'");
$sql_t = "SELECT COUNT(*) as total FROM pm_videos WHERE added <= '". time() ."' AND (category LIKE '%,$cat_id,%' OR category LIKE '%,$cat_id' OR category LIKE '$cat_id,%' OR category='$cat_id') AND video_type = ". IS_VIDEO;
$result_t = @mysql_query($sql_t);
$row = @mysql_fetch_assoc($result_t);
$total_items = $row['total'];
@mysql_free_result($result_t);
@mysql_query("UPDATE pm_categories SET published_videos = '". $total_items ."' WHERE id = '". $cat_id ."'");
}
}
$top_videos = top_videos($config['top_videos_sort'], _TOPVIDS);
$new_videos = get_video_list('added', 'desc', 0, _NEWVIDS);
$featured_videos = get_featured_video_list((int) $config['homepage_featured_limit']);
$total_featured_videos = pm_count($featured_videos);
// Get latest articles
if (_MOD_ARTICLE)
{
$articles = art_load_articles(0, $config['article_widget_limit']);
if ( ! array_key_exists('type', $articles))
{
foreach ($articles as $id => $article)
{
$articles[$id]['title'] = fewchars($article['title'], 55);
}
$smarty->assign('articles', $articles);
}
}
// generate smart pagination
$pagination = '';
if ($total_items > $limit)
{
$append_url = '';
if ( ! _SEOMOD)
{
$append_url = '';
$filename = 'category.php';
if($cat_name != '') $append_url .= 'cat=' . $cat_name;
if($page != '') $append_url .= '&page=' . $page;
if($sortby != '') $append_url .= '&sortby=' . $sortby;
if($order != '') $append_url .= '&order=' . $order;
}
else
{
$filename = "browse-" . $cat_name . "-videos-" . $page . "-" . $sortby . ".html";
}
$pagination = generate_smart_pagination($page, $total_items, $limit, 1, $filename, $append_url, _SEOMOD);
}
$meta_title = $category['meta_title'];
if ($category['meta_title'] == '')
{
if($page != 1 && is_numeric($page))
{
$meta_title = $category_name." ".$lang['videos']." - ".sprintf($lang['page_number'], $page);
}
else
{
$meta_title = $category_name." ".$lang['videos'];
}
}
$meta_description = ($category['meta_description'] != '') ? $category['meta_description'] : $category_name." ".$lang['videos']." - "._SITENAME." - ". $page;
$meta_keywords = $category['meta_keywords'];
$tmp_parts = explode(',', $video['category']);
$related_video_list = get_related_video_list($tmp_parts, $video['video_title'], $config['watch_related_limit'], $video['id']);
$top_rated_video_list = get_top_rated_video_list(array_pop($tmp_parts), $config['watch_toprated_limit'] , $video['id']);
unset($same_category_id);
$videos .= '';
$videos .= make_cats($r['category']);
$videos .= ' | ';
// MAKE SORT BY STICK
if(!empty($cat_id)) {
$list_cats = list_categories(0, $cat_id);
$smarty->assign('list_categories', $list_cats);
} else {
$list_cats = list_categories(0, '');
$smarty->assign('list_categories', $list_cats);
}
if($config['show_tags'] == 1)
{
$tag_cloud = tag_cloud(0, $config['tag_cloud_limit'], $config['shuffle_tags']);
$smarty->assign('tags', $tag_cloud);
$smarty->assign('show_tags', 1);
}
$yazdir = mysql_query("SELECT name FROM pm_categories where id order by id");
$name = $write['name'];
while($row = mysql_fetch_assoc($yazdir)){
$data[] = $row;
}
$smarty->assign('data', $data);
$smarty->assign('total_videos', $total_videos);
$smarty->assign('cat_name', $cat_name);
$smarty->assign('results', $list);
$smarty->assign('top_videos', $top_videos);
$smarty->assign('categories_list', $categories_list);
$smarty->assign('pagination', $pagination);
$smarty->assign('cat_id', $cat_id);
$smarty->assign('problem', $problem);
$smarty->assign('gv_category_name', $category_name);
$smarty->assign('gv_cat', $cat_name);
$smarty->assign('gv_pagenumber', $page);
$smarty->assign('gv_sortby', $sortby);
$smarty->assign('category_name', make_cats($video['category']));
$smarty->assign('gv_category_description', $category['description']);
$smarty->assign('list_subcats', $list_subcats);
$smarty->assign('pagination', $pagination);
$smarty->assign('featured_videos', $featured_videos);
$smarty->assign('featured_videos_total', $total_featured_videos);
$smarty->assign('featured_channels', get_featured_channels());
$smarty->assign('new_videos', $new_videos);
$smarty->assign('top_videos', $top_videos);
$smarty->assign('categories', $_video_categories);
$smarty->assign('featured_categories_data', $featured_categories_data);
$smarty->assign('page_count_info', $page_count_info);
$smarty->assign('pag_left', $pag_left);
$smarty->assign('pag_right', $pag_right);
// --- DEFAULT SYSTEM FILES - DO NOT REMOVE --- //
$smarty->assign('meta_title', htmlspecialchars($meta_title));
$smarty->assign('meta_description', htmlspecialchars($meta_description));
$smarty->assign('template_dir', $template_f);
$smarty->display('video-new.tpl');