Просмотр файла includes/service/forum10/messages.php

Размер файла: 5.46Kb
  1. <?php
  2. if ($pagem<1) $pagem=1;
  3. if ($paget<1) $paget=1;
  4. $pt="";
  5. $pm="";
  6. if ($paget>1) $pt="&amp;pt=".$paget;
  7. if ($pagem>1) $pm="&amp;pm=".$pagem;
  8. print cyr2utf('<card id="forum" title="'.$title.'">');
  9. if (!$autorize) print cyr2utf('<do name="a" type="options" label="Войти"><go href="'.$forum.'?a=a&amp;z='.base64_encode($QUERY_STRING).'"/></do>');
  10.  
  11. $q=mysql(DBName,"SELECT `status` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `status` < 2 AND `l1` = $razdel AND `l2` = $topic AND `l3` = 0 LIMIT 0, 1");
  12. $s=@mysql_num_rows($q)+0;
  13. $f=@mysql_fetch_array($q);
  14. $writestatus=$f['status'];
  15.  
  16. if (($status>0)||(($status>=0)&&($autorize)&&($s>0)&&($writestatus==0))) print cyr2utf('<do name="n" type="options" label="Написать"><go href="'.$forum.'?'.$user.'&amp;a=nm&amp;r='.$razdel.$pt.'&amp;t='.$topic.$pm.'"/></do>');
  17.  
  18. print cyr2utf(
  19. '<do name="t" type="options" label="Темы"><go href="'.$forum.'?'.$user.'&amp;r='.$razdel.$pt.'"/></do>'.
  20. '<do name="r" type="options" label="Разделы"><go href="'.$forum.'?'.$user.'"/></do>'.
  21. '<do name="m" type="options" label="На главную"><go href="'.$mainpage.'"/></do>'.
  22. '<p>'.
  23. $sysmsg);
  24.  
  25. $q=mysql(DBName,"SELECT `text` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `l1` = $razdel AND `l2` = 0 AND `l3` = 0 LIMIT 0, 1");
  26. $s=mysql_num_rows($q);
  27.  
  28. if ($s<1)
  29. print cyr2utf('<br/><small>[Раздел не найден<!--M-->]</small><br/>');
  30. else
  31. {
  32.  
  33. $q=mysql(DBName,"SELECT `status` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `status` < 2 AND `l1` = $razdel AND `l2` = $topic AND `l3` = 0 LIMIT 0, 1");
  34. $s=mysql_num_rows($q)+0;
  35.  
  36. if ($s<1)
  37. print cyr2utf('<br/><small>Тема не найдена, удалена или ее просмотр запрещен</small><br/>');
  38. else
  39. {
  40. $f=mysql_fetch_array($q);
  41. $writestatus=$f['status'];
  42. if (($status>0)||(($autorize)&&($writestatus==0))) print cyr2utf('++<a href="'.$forum.'?'.$user.'&amp;a=nm&amp;r='.$razdel.$pt.'&amp;t='.$topic.$pm.'">Написать</a><br/>');
  43.  
  44. $q=mysql(DBName,"SELECT `l3` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `status` < 2 AND `l1` = $razdel AND `l2` = $topic AND `l3` != 0 ORDER BY `time` DESC LIMIT 0, 1");
  45. $f=mysql_fetch_array($q);
  46. $max_l3=$f[l3];
  47.  
  48. //Загружаем весь список сообщений в нужном порядке.
  49. //$messagelimit
  50. $prnt="";
  51. $nxt=false;
  52. $cpage=0;
  53.  
  54. $q=mysql(DBName,"SELECT `l3` , `status` , `login` , `time` , `text` FROM `$table` WHERE `domain` = '$domain' AND `site` = '$site' AND `status` < 2 AND `l1` = $razdel AND `l2` = $topic AND `l3` != 0 ORDER BY `time` DESC");
  55. $s=mysql_num_rows($q)+0;
  56.  
  57. if ($s<1)
  58. {
  59. if ($paget==1) $prnt.=cyr2utf('Список сообщений поврежден.<br/>');
  60. if ($paget>1) $prnt.=cyr2utf('На данной странице нет сообщений.<br/>');
  61. }
  62. else
  63. {
  64. $prntt="";
  65. if ($pagem>2) $prntt.=cyr2utf('&lt;&lt;=<a href="'.$forum.'?'.$user.'&amp;r='.$razdel.'&amp;pt='.$pt.'&amp;t='.$topic.'&amp;pm=1" accesskey="4">В начало</a><br/>');
  66. if ($pagem<9999)
  67. {if ($pagem>1) $prntt.=cyr2utf( '&lt;=<a href="'.$forum.'?'.$user.'&amp;r='.$razdel.'&amp;pt='.$pt.'&amp;t='.$topic.'&amp;pm='.($pagem-1).'" accesskey="1">Предыдущие</a><br/>');}
  68. else
  69. {if ($pagem>1) $prntt.=cyr2utf( '&lt;=<a href="'.$forum.'?'.$user.'&amp;r='.$razdel.'&amp;pt='.$pt.'&amp;t='.$topic.'&amp;pm=(((BACKPAGE)))" accesskey="1">Предыдущие</a><br/>');}
  70. $prntt.='<small>';
  71.  
  72. $curpageprint="";
  73. for ($i=0;($i<$s);$i++)
  74. {
  75. $f=mysql_fetch_array($q);
  76. $text=$f['text'];
  77. $time=$f['time'];
  78. $flogin=$f['login'];
  79. $l3=$f['l3'];
  80. $nikname=$flogin;
  81. if (($status>0)||(($flogin==$login)&&($l3!=1)&&($l3==$max_l3)))
  82. $delmsg='<a href="'.$forum.'?'.$user.'&amp;a=dm&amp;r='.$razdel.$pt.'&amp;t='.$topic.$pm.'&amp;m='.$l3.'">&#xD7;</a>';
  83. else
  84. $delmsg='';
  85.  
  86. $curmes=cyr2utf('<br/><b>'.$nikname.' '.date("j.m.y G:i",$time).$delmsg.'</b><br/>'.$text.'<br/>');
  87.  
  88. if ((strlen($curpageprint.$curmes)+1800)>$maxsize)
  89. {
  90. $cpage++;
  91. if ($cpage==$pagem) {$tonext=true; $endprnt=$curpageprint;}
  92. if ($cpage==($pagem+1)) {$toend=true; break;}
  93. else {$curpageprint=$curmes;}
  94. }
  95. else
  96. $curpageprint.=$curmes;
  97. }
  98. if (!$tonext) $prntt.=$curpageprint;
  99. else $prntt.=$endprnt;
  100.  
  101. $prnt.=str_replace("(((BACKPAGE)))",$cpage,$prntt);
  102. }
  103.  
  104. print $prnt.'</small>';
  105. }
  106.  
  107. if ($tonext) print cyr2utf('<br/>=&gt;<a href="'.$forum.'?'.$user.'&amp;r='.$razdel.$pt.'&amp;t='.$topic.'&amp;pm='.($pagem+1).'" accesskey="3">Следующие</a>');
  108. if ($toend) print cyr2utf('<br/>=&gt;&gt;<a href="'.$forum.'?'.$user.'&amp;r='.$razdel.$pt.'&amp;t='.$topic.'&amp;pm=9999" accesskey="6">В конец</a>');
  109. if ($toend || $tonext) print '<br/>';
  110.  
  111. if (($status>0)||(($status=0)&&($autorize)&&($writestatus==0))) print cyr2utf('<br/>++<a href="'.$forum.'?'.$user.'&amp;a=nm&amp;r='.$razdel.'&amp;pt='.$pt.'&amp;t='.$topic.$pm.'" accesskey="2">Написать</a>');
  112. }
  113.  
  114.  
  115. print cyr2utf('<br/>&lt;<a href="'.$forum.'?'.$user.'&amp;r='.$razdel.$pt.'" accesskey="9">Темы</a>');
  116. print cyr2utf('<br/>&lt;&lt;<a href="'.$forum.'?'.$user.'" accesskey="7">Разделы</a>');
  117.  
  118. print $endtext;
  119. exit();
  120. ?>