sql_query($sql);
$row = $db->sql_fetchrow($result);
$module_title = $row[custom_title];
if ($pid == "") {
$sql = "select title, description FROM ".$prefix."_catalog_categories_movie where cid='$cid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$page_title = $row[title];
$pagetitle = "| $module_title | $page_title";
}
else {
$sql = "select cid, title, text FROM ".$prefix."_catalog_movie where pid='$pid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$metacontent = $row[text];
$content_title = $row[title];
$catcid = $row[cid];
$sql = "select title FROM ".$prefix."_catalog_categories_movie where cid='$catcid'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$page_title = $row[title];
$pagetitle = "| $module_title | $page_title | $content_title";
}
$content2=strip_tags($metacontent);
$htmlless = check_html($content2, $strip = nohtml);
$symbolLess = trim(ereg_replace('("|\?|!|:|\.|\(|\)|;|\\\\)+', ' ', $htmlless));
$keywords = ereg_replace('( |'.CHR(10).'|'.CHR(13).')+', ',', $symbolLess);
$keywords2 = substr($keywords,0,1600);
$pieces = array_unique (explode (",", $keywords2));
for ($i=0,$j=7; $i < sizeof($pieces) && $j < 1600; $i++) {
if ( ($slen=strlen($pieces[$i])) > 4) {
$browserkeywords="$browserkeywords".", "."$pieces[$i]"; $j+=$slen+2; }
}
if ($_COOKIE["activeonly"]==''){
setcookie ("activeonly", 0); //himik сделал 0 (было 1). по умолчанию показываем в последних добавлениях ВСЕ фильмы.
$_COOKIE["activeonly"]=0;
// $sucker=$_COOKIE["activeonly"];
// echo "SUCKER! $sucker";
}
// $sucker2=$_COOKIE["activeonly"];
// echo "SUCKER2 ! $sucker";
///////////////////////////////
///get config/////
$sql = "select * FROM ".$prefix."_catalog_cfg where cfgid=1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$blk_active = $row[blk_active];
$blk_reting = $row[blk_reting];
$blk_dl = $row[blk_dl];
$blk_lastmov = $row[blk_lastmov];
$blk_topview = $row[blk_topview];
$blk_req = $row[blk_req];
$reiting_lim=$row[reiting_lim];
$dl_lim = $row[dl_lim];
$lastmov_lim = $row[lastmov_lim];
$topview_lim = $row[topview_lim];
$comments_cfg =$row[comments_cfg];
$shw_none =$row[shw_none];
$last_update =$row[last_upd];
$bcfg1=$row[bcfg1];
$bcfg2=$row[bcfg2];
$defurl=$row[defurl];
$dwncfg=$row[dwn];
$cadrcfg=$row[cadr];
$dwncfg=$row[dwn];
if ($dwncfg==2){
$sql = "select mid, muid FROM ".$prefix."_catalog_users";
$result = $db->sql_query($sql);
$user_list=array();
while(list($mid, $mu_id) = $db->sql_fetchrow($result)){
$user_list[]=$mu_id;
}
}
function getparent($parentid,$title) {
global $prefix,$db;
$result=$db->sql_query("select cid, title, parentid from ".$prefix."_catalog_categories_movie where cid=$parentid");
list($cid, $ptitle, $pparentid) = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
if ($ptitle!="") $title=$ptitle."/".$title;
if ($pparentid!=0) {
$title=getparent($pparentid,$title);
}
return $title;
}
function reitinggraphic($votes, $totalvotes) {
global $module_name;
if ($votes==0){
$reiting=0;
}else{$reiting = $totalvotes/$votes;}
$r_image = round($reiting);
if ($r_image == 0) {
$content = "";
}
if ($r_image == 1) {
$content ="";
}
if ($r_image == 2) {
$content = "";
}
if ($r_image == 3) {
$content = "";
}
if ($r_image == 4) {
$content = "";
}
if ($r_image == 5) {
$content = "";
}
return ($content);
}
function showvideo($pid, $cid, $page=0, $order, $sort, $lettereng, $letter) {
global $bcfg1, $prefix, $db, $sitename,$user, $admin, $module_name, $module_title, $level, $maxlink, $poolfiles,$comments_cfg,$blk_reting,$template, $bgcolor1, $bgcolor2, $cadrcfg, $dwncfg, $user_list, $cookie;
if ($bcfg1==1){$bcfg=1;}else{$bcfg=0;}
$cat_link= "$module_title";
$cat_link.=get_catlink($pid);
$sql = "SELECT votes, totalvotes FROM ".$prefix."_catalog_movie_poolchec WHERE pid='$pid' order by votes desc limit 1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$votes = $row[votes];
$totalvotes = $row[totalvotes];
/////////////next-prev
if (!isset($order)){
$order="upd";
}else if(preg_match("/\./i",$order)){
$order=substr($order,2);
}
if ($_COOKIE["activeonly"]==''){
$where="WHERE active='1' ";
$act="active='1' AND";
}else if ($_COOKIE["activeonly"]==0){
$where="";
}else if ($_COOKIE["activeonly"]==99){
$where="WHERE (active!='0' AND active!='6') ";
} else {
$res = $db->sql_query("select a_id from ".$prefix."_catalog_movie_active");
while(list($a_id) = $db->sql_fetchrow($res)) {
if ($_COOKIE["activeonly"]==$a_id) {
$where="WHERE active='$a_id' ";
$act="active='$a_id' AND";
}
}
}
if ($cid==true AND $_COOKIE["activeonly"]!=0){
$where.="AND cid='$cid' OR $act cid2='$cid' OR $act cid3='$cid' ";
$order ="original";
$sql = "SELECT title FROM ".$prefix."_catalog_categories_movie where cid=$cid";
$result = $db->sql_query($sql);
$row=$db->sql_fetchrow($result);
$kat="Жанр $row[title]";
}else if ($cid==true){
$where.="WHERE cid='$cid' OR cid2='$cid' OR cid3='$cid'";
$order ="original";
$sql = "SELECT title FROM ".$prefix."_catalog_categories_movie where cid=$cid";
$result = $db->sql_query($sql);
$row=$db->sql_fetchrow($result);
$kat="Жанр $row[title]";
}
if ($lettereng!="" AND $_COOKIE["activeonly"]!=0){
$where.="AND original like '$lettereng%' ";
$order ="original";
$kat="Буква $lettereng";
}else if ($lettereng!=""){
$where.="WHERE original like '$lettereng%' ";
$order ="original";
$kat="Буква $lettereng";
}
if ($letter==true AND $_COOKIE["activeonly"]!=0){
$where.="AND title like '$letter%' ";
$order ="title";
$kat="Буква $letter";
}else if ($letter==true){
$where.="WHERE title like '$letter%' ";
$order ="title";
$kat="Буква $letter";
}
$array='';
$sql = "SELECT pid FROM ".$prefix."_catalog_movie $where ORDER BY $order";
$result = $db->sql_query($sql);
while($arrows = $db->sql_fetchrow($result)) {
$array[] = $arrows['pid'];
}
$key = array_search($pid, $array);
$pidprew=$array[$key-1];
$pidnext=$array[$key+1];
////////////////////////
$sql = "SELECT * FROM ".$prefix."_catalog_movie WHERE pid='$pid'";
$result = $db->sql_query($sql);
$mypage = $db->sql_fetchrow($result);
if (!is_admin($admin)){
$db->sql_query("UPDATE ".$prefix."_catalog_movie SET counter=counter+1 WHERE pid='$pid'");
}
$date = explode(" ", $mypage[date]);
$pid1=$pid-1;
$pid2=$pid+1;
if ($pidprew!=''){
$prew="";
}
if ($pidnext!=''){
$next="";
}
if (!$mypage[image]==""){
$image=$mypage[image];
$width= img_width("reliz/video/thumbs/$image");
$width2= img_width("reliz/video/$image");
$sourcefile="reliz/video/$image";
if (file_exists("reliz/video/my_copyright.png")){
$watermarkfile="reliz/video/my_copyright.png";
}else{
$watermarkfile="modules/$module_name/images/copyright.png";
}
$image2="index.php?name=$module_name&file=image&sourcefile=$sourcefile&watermarkfile=$watermarkfile";
// himik
// $picture= "";
$width_2=200;
$picture2='';
if ($width2 <= 200)
$width_2=$width2;
if ($width2 >= 200)
$picture2="Увеличить";
$picture= "
";
//зв®Ў Ґ ¤Ґ« вм Є«ЁЄ
// $picture= "";
//
}else{
$picture= "";}
if (!$mypage[logo]==""){
$logo=" ";
}
if ($blk_reting==1){$reyt_name=""._REYT.":"; $reyt=reitinggraphic($votes, $totalvotes); }
if($mypage[year]==true){ $year_name= ""._YEAR.":"; $year=$mypage[year]; }
if($mypage[fabrik]==true){
$st_name=""._STUDIO."";
$studio=$mypage[fabrik];
$studio=findPerson($studio,"fabrik");
}
if($mypage[editor]==true){
$ed_name=""._EDITOR.":";
$editor=$mypage[editor];
$editor=findPerson($editor,"editor");
}
if($mypage[page_header]==true){
$cast_name=""._CASTNAME.":";
$cast=$mypage[page_header];
$casting=findPerson($cast,"cast");
}
if($mypage[more]==true){ $more_name=""._MORE.":"; $more=$mypage[more]; }
if($mypage[text]==true){ $a_name=""._ABOUT.":"; $about=nl2br($mypage[text]); }
if($mypage[lange]==true){ $lange_name=" "._LANGE.":"; $lange=nl2br($mypage[lange])." минут."; }
if ($dwncfg==1){
if($mypage[ubersetz]==true){ $ubersetz_name=" "._UBERSETZ.":"; $ubersetz= nl2br($mypage[ubersetz]); }
if($mypage[format]==true){ $format_name=" "._FORMAT.":"; $format=$mypage[format]; }
if($mypage[qualitet]==true){ $qualitet_name=" "._QUALITET.":"; $qualitet=$mypage[qualitet]; }
if($mypage[video]==true) { $video_name=" "._VIDEO.":"; $video=$mypage[video]; }
if($mypage[audio]==true){ $audio_name=" "._AUDIO.":"; $audio=$mypage[audio]; }
}
$a_id=$mypage[active];
$row = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_catalog_movie_active WHERE a_id='$a_id'"));
cookiedecode($user);
if (($row[dwn]==1 OR ($row[dwn]==2 AND is_user($user))) AND ($mypage[link]==true AND ($dwncfg==1 OR ($dwncfg==2 AND in_array($cookie[0], $user_list))))){
//eregi ("^(http|https|ftp|ed2k)+(:\/\/)(.*)",$image
if (!eregi ("^(http|https|ftp|ed2k)+(:\/\/)(.*)",$mypage[link])){
$playb_link="";
$playw_link="";
$playv_link="";
}
if (eregi ("^(ftp)+(:\/\/)(.*)",$mypage[link])){
$playv_link="";
}
}
if ($mypage[link]==true){
$height=150;
if (file_exists("modules/$module_name/sms_ftp.php"))
$height=430;
$height=$height+30+(ceil(count(explode("\n",$mypage[link])))*6);
if ($mypage[link2]==true){$height=$height+30+(ceil(count(explode("\n",$mypage[link2]))/6)*100);}
if ($mypage[link3]==true){$height=$height+30+(ceil(count(explode("\n",$mypage[link3]))/6)*100);}
$link_tmp =""._DOWNLOAD." ";
$link_tmp2 =""._DOWNLOAD." ";
$for_mark=$mypage[link];
}
//------
// himik
// show download counter in online2user mode
// ------------------------------------------
if ($row[dwn]==1 AND ($dwncfg==1 OR ($dwncfg==2 AND in_array($cookie[0], $user_list)))){
//if ($dwncfg==1 OR ($dwncfg==2 AND in_array($cookie[0], $user_list))){
if ($mypage[link]==true){
$link = $link_tmp;
$linknopop = $link_tmp2;
}
if ($mypage[razmer]==true){$size_name=" "._SIZE.":"; $size=nl2br($mypage[razmer]);}
$dlres=dlcount($pid);
if (is_admin($admin)){
$dl_name=" "._DOWNLOADS."";
}else{
$dl_name=" "._DOWNLOADS."";
}
$dl=$dlres[0]." раз. ";
if ($dlres[0]!==0){
$last_name=""._LASTTIME.":";
$last=$dlres[1];
}
}else if($row[dwn]==2 AND ($dwncfg==1 OR ($dwncfg==2 AND in_array($cookie[0], $user_list)))){
if ($mypage[razmer]==true){$size_name=" "._SIZE.":"; $size=nl2br($mypage[razmer]);}
$dlres=dlcount($pid);
if (is_admin($admin)){
$dl_name=" "._DOWNLOADS."";
}else{
$dl_name=" "._DOWNLOADS."";
}
$dl=$dlres[0]." раз. ";
if ($dlres[0]!==0){
$last_name=""._LASTTIME.":";
$last=$dlres[1];
}
if ($row[image]==true){$dl_img="";}
if (is_user($user)){$link = $link_tmp;$linknopop = $link_tmp2;
}else{$link =$row[des];}
}else if($dwncfg==1){
if ($row[image]==true){$dl_img="";}
$link =$row[des];
if (is_admin($admin)){$admin_link =$mypage[link];}
}
$views_name = " "._VIEWS."";
$views=nl2br($mypage[counter])." раз.";
if (!$mypage[date]==""){$add_name=" "._ADDDED.":";$add=$mypage[date];}
if (($row[dwn]==1 OR ($row[dwn]==2 AND is_user($user))) AND ($mypage[link]==true AND ($dwncfg==1 OR ($dwncfg==2 AND in_array($cookie[0], $user_list))))){
$broken = ""._REPORTBROKEN."";
}
if (is_admin($admin)) {$delete =""._DELETE.""; $edit=""._EDIT.""; $admincadrs=""._EDITCADRS."";}
$back= ""._PBACK."";
$home= ""._PHOME."";
if ($comments_cfg==1){
$comments=showcomment($pid);
$comments_form=comment_form($pid, '');
}
$lettr_search=fastsearch();
$text_search=fastsearchtext();
headerblock($bcfg);
OpenTable();
//
// Load templates
//
$template->set_filenames(array(
'body' => 'modules/'.$module_name.'/tmpl/show_video.tpl')
);
If ($mypage[original]!='' AND $mypage[title]!=''){
if ($lettereng==true){
$name=$mypage[original]." / ".$mypage[title];
}else{
$name=$mypage[title]." / ".$mypage[original];
}
}else if($mypage[original]!=''){
$name=$mypage[original];
}else{
$name=$mypage[title];
}
$name4m=$mypage[title];
$cadrslink.="
\n";
$cadrslink.="
\n";
if ($db->sql_fetchrow($db->sql_query("select * from ".$prefix."_catalog_cadr where pid='$pid' and cdrstat=1"))){
$cadrslink.=" \n";
}
if ($cadrcfg!=0 OR is_admin($admin)){
$cadrslink.=" "._ADD_CADR."";
$cadrslink.=" "._ADD_CADR2."
";
CloseTable();
}
function sendResponse($content) {
global $embed;
if ($embed) { ob_end_clean(); }
/*
#TODO:
#global $play_on_server;
$play_on_server = true;
if ($play_on_server) {
session_write_close();
#echo $content; exit();
#exec("/usr/local/bin/mpg123 -q $content 0 1> /dev/null 2>&1 &");
exec("bgrun.exe \"f:\Progra~1\Winamp\winamp.exe\" $content >NUL");
// exit();
}
*/
header("Content-Disposition: inline; filename=playlist.bsl");
header("Content-type: video/mpegurl");
header("Cache-control: private"); #IE seems to need this.
echo $content;
exit;
}
#################################################################################
function searchtext($poisk, $title, $original, $editor, $fabrik, $page_header, $text, $year, $num){
global $bgcolor1, $bgcolor2, $bcfg2, $prefix, $db, $sitename, $admin, $module_name, $module_title;
if ($bcfg2==1){$bcfg=1;}else{$bcfg==0;}
headerblock($bcfg);
OpenTable();
if ($_COOKIE["activeonly"]==''){
$where2="p.active=1 AND";
}else if ($_COOKIE["activeonly"]==0){
$where2="";
}else if ($_COOKIE["activeonly"]==99){
$where2="(p.active!='0' AND p.active!='6') AND";
} else {
$res = $db->sql_query("select a_id from ".$prefix."_catalog_movie_active");
while(list($a_id) = $db->sql_fetchrow($res)) {
if ($_COOKIE["activeonly"]==$a_id) {
$where2="p.active=$a_id AND";
}
}
}
// хитрая хрень на самом деле
// если у вас сервер в KOI8-r, а сайт в CP1251
// то регистр символов в команде strto... меняется
// во всяком случае.
// Сей код определеят тип и делает вроде бы нормальную перекодировку
$poisk=toupper($poisk);
//echo "$poisk - $strf - $poisk2";
$or=0;
If ($title==true){
$where.="$where2 UPPER(p.title) like '%$poisk%'";
}
If ($original==true){
if ($where==true){
$where.=" OR ";
}
$where.="$where2 UPPER(p.original) like '%$poisk%'";
}
If ($editor==true){
if ($where==true){
$where.=" OR ";
}
$where.="$where2 UPPER(p.editor) like '%$poisk%'";
}
If ($fabrik==true){
if ($where==true){
$where.=" OR ";
}
$where.="$where2 UPPER(p.fabrik) like '%$poisk%'";
}
If ($page_header==true){
if ($where==true){
$where.=" OR ";
}
$where.="$where2 UPPER(p.page_header) like '%$poisk%'";
}
If ($text==true){
if ($where==true){
$where.=" OR ";
}
$where.="$where2 UPPER(p.text) like '%$poisk%'";
}
If ($year==true){
if ($where==true){
$where.=" OR ";
}
$where.="$where2 UPPER(p.year) like '%$poisk%'";
}
If ($num==true){
$where="$where2 UPPER(p.title) like '%$poisk%' OR $where2 UPPER(p.original) like '%$poisk%' OR $where2 UPPER(p.year) like '%$poisk%' OR $where2 UPPER(p.editor) like '%$poisk%' OR $where2 UPPER(p.fabrik) like '%$poisk%' OR $where2 UPPER(p.page_header) like '%$poisk%' OR $where2 UPPER(p.text) like '%$poisk%' OR $where2 UPPER(p.more) like '%$poisk%'";
}
$order='p.title DESC';
$sql="SELECT p.pid, p.cid, p.cid2, p.cid3, p.title, p.original, p.image, p.logo, p.logolink, p.active, p.fabrik, p.editor, p.page_header,p.text, p.link, p.more, p.date, p.counter, p.link2, p.link3, p.year, p.razmer, p.lange, p.ubersetz, p.format, p.qualitet, p.video, p.audio, p.upd, c.cid, c.title, c.parentid
FROM ".$prefix."_catalog_movie as p
LEFT JOIN ".$prefix."_catalog_categories_movie as c on (p.cid=c.cid)
WHERE $where ORDER BY $order";
$res = $db->sql_query($sql);
$numrows = $db->sql_numrows($res);
Echo "
\n";
}
}
function set_activeonly($active_only){
global $module_name;
setcookie ("activeonly", $active_only);
Header("Location: index.php?name=$module_name");
}
function activeonly(){
global $module_name, $module_name;
$location=$HTTP_REFERER;
//$HTTP_URI;
global $db, $prefix, $shw_none, $dwncfg;
if ($dwncfg==0){
$dw="WHERE dwn=0";
$currentactive=$_COOKIE["activeonly"];
if ($db->sql_fetchrow($db->sql_query("Select dwn From ".$prefix."_catalog_movie_active where a_id=$currentactive and dwn!=0"))) {setcookie ("activeonly", "99");}
}else{$dw='';}
$res = $db->sql_query("select * from ".$prefix."_catalog_movie_active $dw order by name");
$content .="
"._SHOWACTIVE."
";
$content .="
";
return ($content);
}
function footerblock($pid,$bcfg,$active){
if ($bcfg==1){
$ThemeSel = get_theme();
global $blk_active, $blk_reting, $blk_dl, $blk_lastmov, $blk_topview, $blk_req, $admin, $prefix, $db, $cadrcfg,$dwncfg;
if (is_admin($admin)){
Echo " ";
OpenTable();
echo "