【php开源代码栏目提醒】:网学会员鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“func.video.php”一文,供大家参考学习
<?php
function geturl_video( $vid )
{
$settings=$GLOBALS['settings'];
$site_url= $GLOBALS['site_url'];
$video_path = $site_url."video.php?vid=".$vid;
exit($site_url);
$siteurl = str_replace( "http://", "", $settings['video_set']['siteurl'] );
$video_src = $site_url."player.php?ivid={$ivid}&s=".base64_encode( $siteurl );
$video_flash = "[flash]".$video_src."[/flash]";
$video_swf = "[swf]".$video_src."[/swf]";
$video_object = htmlspecialchars( "<object width=\"450\" height=\"390\"><param name=\"wmode\" value=\"transparent\" /><param name=\"movie\" value=\"".$video_src."\"><embed src=\"".$video_src."\" type=\"application/x-shockwave-flash\" width=\"450\" height=\"390\"></embed></object>" );
return array(
"video_path" => $video_path,
"video_src" => $video_src,
"video_flash" => $video_flash,
"video_swf" => $video_swf,
"video_object" => $video_object
);
}
function update_video( $vid, $param = UPDATE_VIDEO_ALL )
{
$db= $GLOBALS['db'];
$tablepre= $GLOBALS['tablepre'];
$timestamp= $GLOBALS['timestamp'];
$newdata = array( );
if ( $param == UPDATE_VIDEO_ALL || $param == UPDATE_VIDEO_COMMENTS )
{
$sql = "SELECT COUNT(*) FROM {$tablepre}comments WHERE vid='{$vid}'";
$newdata['comments'] = $db->result( $db->query( $sql ), 0 );
}
if ( $param == UPDATE_VIDEO_ALL || $param == UPDATE_VIDEO_FAVS )
{
$sql = "SELECT COUNT(*) FROM {$tablepre}favs WHERE vid='{$vid}'";
$newdata['favs'] = $db->result( $db->query( $sql ), 0 );
}
$sql = "UPDATE {$tablepre}videos SET utime='{$timestamp}'";
foreach ( $newdata as $colum => $value )
{
$sql .= ", {$colum}='{$value}'";
}
$sql .= " WHERE vid='{$vid}'";
$db->query( $
sql );
return true;
}
function member_video( $mid, $vid = 0, $limit = 12, $mask = FUNC_MASK_DEFAULT )
{
$videos = $orderarr = array( );
$videocount = 0;
require_once( SUPEV_ROOT."./lib/class/class.module.php" );
$mvideo = new module_cls( "video" );
$mvideo->addorder( $orderarr, "ctime" );
$paramarr = array(
"myid" => $mid,
"start" => 0,
"limit" => $limit,
"fmttime" => "Y-m-d H:i:s",
"order" => $orderarr
);
$mres = $mvideo->call( "qy_user", $paramarr, $mask );
if ( 0 < $module->errno )
{
show( $mvideo->errno );
}
$videos = $mres['data'];
unset( $videos[$vid] );
$videocount = count( $videos );
return array(
"videos" => $videos,
"videocount" => $videocount
);
}
function tag_relatevideo( $tag, $vid = 0, $limit = 18 )
{
$db= $GLOBALS['db'];
$tablepre= $GLOBALS['tablepre'];
$videos = $orderarr = $ids = array( );
$videocount = 0;
$tagstr = "";
if ( !empty( $tag ) )
{
if ( is_array( $tag ) )
{
$tagstr = implodeids( $tag );
$sql = "SELECT * FROM {$tablepre}videotags WHERE tag IN ({$tagstr}) LIMIT {$limit}";
}
else
{
$sql = "SELECT * FROM {$tablepre}videotags WHERE tag LIKE '%{$tag}%' LIMIT {$limit}";
}
$res = $db->query( $sql );
while ( $row = $db->fetch_array( $res ) )
{
if ( $vid != $row['vid'] )
{
$ids[] = $row['vid'];
}
}
}
if ( !empty( $ids ) )
{
$ids = implodeids( $ids );
$sql = "SELECT * FROM {$tablepre}videos WHERE vid IN({$ids}) AND publish='".PUBLISH_ACCESS."'";
$res = $db->query( $sql );
$videos = array( );
while ( $row = $db->fetch_array( $res ) )
{
$row['ctime'] = getuploadtime( $row['ctime'] );
$row['times'] = getplaytime( $row['times'] );
if ( $row['thumb'] == 1 )
{
$path = getthumb_path( $row['ivid'] );
$row['sthumb'] = $path."s.jpg";
$row['bthumb'] = $path.".jpg";
}
else
{
$row['sthumb'] = "#";
$row['bthumb'] = "#";
}
$videos[$row['vid']] = $row;
}
}
$videocount = count( $videos );
return array(
"videos" => $videos,
"videocount" => $videocount
);
}
function commend_video( $limit = 13 )
{
$db= $GLOBALS['db'];
$tablepre= $GLOBALS['tablepre'];
$commend_array = $commend_pic_array = $commend_txt_array = array( );
$commend_pic_num = 3;
$commend_txt_num = $limit - $commend_pic_num;
$sql = "SELECT * FROM {$tablepre}videos ORDER BY pushs DESC, views DESC LIMIT {$limit}";
$res = $db->query( $sql );
while ( $row = $db->fetch_array( $res ) )
{
if ( $row['thumb'] == 1 )
{
$path = getthumb_path( $row['ivid'] );
$row['sthumb'] = $path."s.jpg";
$row['bthumb'] = $path.".jpg";
}
else
{
$row['sthumb'] = "#";
$row['bthumb'] = "#";
}
$commend_array[$row['vid']] = $row;
}
$videocount = count( $commend_array );
if ( $commend_pic_num < $videocount )
{
foreach ( $commend_array as $row )