<?
function article_params($catselect,$levelselect,$fdata,$fcontainer,$langselect) { ?>
<form action=index.php method=POST>
<table class="innertable" cellspacing=1><tr><td class="tablehead" colspan=2><?=MSG_f_params;?></td></tr>
<tr class="basictable"><td width=50%><?=MSG_f_title;?>:
</td><td>
<input type=text name=f_title size=30 maxlength=60 value="<?=$fdata['f_title'];?>">
</td></tr><tr class="basictable"><td><?=MSG_f_descr;?>:
</td><td>
<textarea name=f_descr rows=3 cols=30><?=textarea($fdata['f_descr']);?></textarea>
</td></tr><tr class="basictable"><td>
<?=MSG_f_cat;?>:
</td><td>
<select name=f_ctid><? set_select($catselect,$_POST['ctid']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_show_in;?>:
</td><td>
<select name=f_parent><? set_select($fcontainer,$fdata['f_parent']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_langs;?>?
</td><td>
<select name=f_lnid><?=set_select($langselect,$fdata['f_lnid']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_close;?>?
</td><td>
<input type=radio name=f_status value=0 <? check($fdata['f_status']==0);?>><?=MSG_no;?> &nbsp;
<input type=radio name=f_status value=1 <? check($fdata['f_status']==1);?>><?=MSG_yes;?> &nbsp;
</td></tr><tr class="basictable"><td>
<?=MSG_f_rules;?></td><td>
<textarea name=f_rules rows=12 cols=30><?=textarea($fdata['f_rules']);?></textarea>
</td></tr><tr class="basictable"><td>
<?=MSG_f_nonewpic;?></td><td>
<input type=text name=f_nonewpic size=20 maxlength=20 value=<?=$fdata['f_nonewpic'];?>>
</td></tr><tr class="basictable"><td>
<?=MSG_f_newpic;?></td><td>
<input type=text name=f_newpic size=20 maxlength=20 value=<?=$fdata['f_newpic'];?>>
</td></tr><tr class="basictable"><td>
<?=MSG_f_rate;?>?
</td><td>
<input type=radio name=f_rate value=0 <? check($fdata['f_rate']==0);?>><?=MSG_no;?> &nbsp;
<input type=radio name=f_rate value=1 <? check($fdata['f_rate']==1);?>><?=MSG_yes;?> &nbsp;
</td></tr><tr class="basictable"><td>
<?=MSG_f_bcode;?>?
</td><td>
<input type=radio name=f_bcode value=0 <? check($fdata['f_bcode']==0);?>><?=MSG_no;?> &nbsp;
<input type=radio name=f_bcode value=1 <? check($fdata['f_bcode']==1);?>><?=MSG_yes;?> &nbsp;
</td></tr><tr class="basictable"><td>
<?=MSG_f_smiles;?>?
</td><td>
<input type=radio name=f_smiles value=0 <? check($fdata['f_smiles']==0);?>><?=MSG_no;?> &nbsp;
<input type=radio name=f_smiles value=1 <? check($fdata['f_smiles']==1);?>><?=MSG_yes;?> &nbsp;
</td></tr><tr class="basictable"><td>
<?=MSG_f_stats;?>?
</td><td>
<input type=radio name=f_nostats value=1 <? check($fdata['f_nostats']==1);?>><?=MSG_no;?> &nbsp;
<input type=radio name=f_nostats value=0 <? check($fdata['f_nostats']==0);?>><?=MSG_yes;?> &nbsp;
</td></tr><tr class="basictable"><td>
<?=MSG_f_premod;?>?
</td><td>
<input type=radio name=f_premoderate value=0 <? check($fdata['f_premoderate']==0);?>><?=MSG_no;?> &nbsp;
<input type=radio name=f_premoderate value=1 <? check($fdata['f_premoderate']==1);?>><?=MSG_yes;?> &nbsp;
</td></tr><tr><td class="tablehead" colspan=2><?=MSG_f_levels;?></td></tr>
<tr class="basictable"><td>
<?=MSG_f_lview;?>
</td><td>
<select name=f_lview><? set_select($levelselect,$fdata['f_lview']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lread;?>
</td><td>
<select name=f_lread><? set_select($levelselect,$fdata['f_lread']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lpost;?>
</td><td>
<select name=f_lpost><? set_select($levelselect,$fdata['f_lpost']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_ltopic;?>
</td><td>
<select name=f_ltopic><? set_select($levelselect,$fdata['f_ltopic']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_ledit;?>
</td><td>
<select name=f_ledit><? set_select($levelselect,$fdata['f_ledit']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lvote;?>
</td><td>
<select name=f_lvote><? set_select($levelselect,$fdata['f_lvote']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lsticky;?>
</td><td>
<select name=f_lsticky><? set_select($levelselect,$fdata['f_lsticky']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lhtml;?>
</td><td>
<select name=f_lhtml><? set_select($levelselect,$fdata['f_lhtml']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lmoderate;?>
</td><td>
<select name=f_lmoderate><? set_select($levelselect,$fdata['f_lmoderate']);?></select>
</td></tr><tr class="basictable"><td>
<?=MSG_f_lip;?>
</td><td>
<select name=f_lip><? set_select($levelselect,$fdata['f_lip']);?></select>
</td></tr>
<tr><td class="tablehead" colspan=2>
<input type=hidden name=a value="<?=$GLOBALS['newaction'];?>">
<input type=hidden name=m value="<?=$GLOBALS['newmodule'];?>">
<input type=hidden name=f_tpid value="<?=$fdata['f_tpid'];?>">
<input type=hidden name=fid value=<?=getvar("fid");?>>
<input type=submit value="<?=MSG_save;?>">
</td></tr></table></form>
<? }

function article_list_start($pages) {
if ($GLOBALS['opt_exttopic']) {
  if ($GLOBALS['inuserid']>3) {
  if ($GLOBALS['userlast2']) { ?>
<div class="descr"><?=MSG_lastvisit;?> "<?=$GLOBALS['inforum']['f_title'];?>" <?=long_date_out($GLOBALS['userlast2']);?></div>
<? }
  else { ?><div class="descr"><?=MSG_welcome;?> "<?=$GLOBALS['inforum']['f_title'];?>".</div><?}
} ?>
<? if ($GLOBALS['inforum']['f_rules']) { ?><a class="rules" href="index.php?f=<?=$GLOBALS['forum'];?>&amp;a=f_rules"><?=MSG_f_rules;?></a><br><? } ?>
<? if ($GLOBALS['inuserid']>3) { ?><a class="descr" href="index.php?m=newpost&amp;fs=<?=$GLOBALS['forum'];?>&amp;a=do_mark_read"><?=MSG_f_marktopics;?></a><br><br><? } ?>
<noindex>
<form class="descr" style="text-align: right" action="index.php" method=GET>
<?=MSG_f_sortby;?> <select name=o><?=set_select("<option value=posttime>".MSG_a_byadddate.
"<option value=posttime>".MSG_a_bylastcomment."<option value=t_title>".MSG_f_bytitle.
"<option value=t__views>".MSG_f_byviews."<option value=pcount>".MSG_a_bycomments.
"<option value=trating>".MSG_f_byrating."<option value=visited>".MSG_f_byvisit,getvar("o"));?></select>
, <?=MSG_showby;?> <select name=desc><?=set_select("<option value=\"\">".MSG_asc."<option value=desc>".MSG_desc,getvar("desc"));?></select>
<input type=hidden name=f value="<?=$GLOBALS['forum'];?>"> <input type=submit value="<?=MSG_show;?>"></form>
</noindex><?
}?>
<table width=100% cellspacing=1 border=0><tr><td>
<table cellspacing=0 cellpadding=0 width=100%><tr><td width=20%>&nbsp;</td><td width=60%><H3 >
<?=MSG_a_list;?> "<?=$GLOBALS['inforum']['f_title'];?>"</H3></td><td width=20% class="basictable" style="text-align:right"><?=$pages;?>
</td></tr></table></td></tr>
<tr><td>&nbsp;</td></tr>
<? }

function article_list_entry(&$adata) {
?><tr><td class="basictable">
<b><a href="index.php?t=<?=$adata['t_id'];?>"><?=$adata['t_title'];?></a></b><?
if ($adata['t_descr']) { ?>
<br> <?=$adata['t_descr'];?><? } ?><br>
<span class="descr"><? if (is_new(!$adata['visited'],$adata['lastpost'])) { ?>
<span style="color: #EE0000">NEW!</span> <? } ?>
<?=MSG_a_author;?>: <? if ($adata['a_authormail']) { ?><a href="mailto:<?=$adata['a_authormail'];?>"><?=$adata['a_author'];?></a><? }
else { ?><?=$adata['a_author'];?><? } ?> |
 <?=MSG_t_rating;?>: <? if ($adata['trating']) { ?><?=$adata['trating'];?><? }
else { ?><?=MSG_none;?><? } ?> |
 <?=MSG_t_views;?>: <?=$adata['t__views'];?> |
 <?=MSG_a_comments;?>: <?=$adata['pcount']-1;?>
 <? if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) { ?>
 | <a class="descr" href="index.php?m=article&a=edit_article&t=<?=$adata['t_id'];?>"><?=MSG_a_edit;?></a><? } ?>
</span><br>&nbsp;</td></tr>
<? }

function article_list_end() { ?>
</table><?
if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_ltopic']) { ?>
<br><noindex><div class="modlinks"><a href="index.php?m=article&a=add_article&f=<?=$GLOBALS['forum'];?>"><?=MSG_a_add;?></a>
<? }
if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) {
  if ($premodcount=get_premod()) { ?>
<a href="index.php?m=moderate&a=premod&f=<?=$GLOBALS['forum'];?>"><?=MSG_f_premoderate;?></a> (<?=format_word($premodcount,MSG_p1,MSG_p2,MSG_p3);?>)
<? } ?> | <a href="index.php?m=moderate&a=mod_banlist&f=<?=$GLOBALS['forum'];?>"><?=MSG_f_banusers;?></a>
 | <a href="index.php?m=moderate&a=mod_forum&f=<?=$GLOBALS['forum'];?>"><?=MSG_f_moderate;?></a>
<? } ?>
</div></noindex><br>
<? }

function article_display(&$tdata,&$adata,&$pdata,$rated,$pages) {
?>
<table width=100% cellspacing=1><tr><td><H3 style="text-align: center"><?=$tdata['t_title'];?></H3></td></tr>
<tr class="basictable"><td style="text-align: justify"><div style="text-align: right">
<?=MSG_a_author;?>: <?
if ($adata['a_authormail']) { ?><a href="mailto:<?=$adata['a_authormail'];?>"><?=$adata['a_author'];?></a><? }
else { ?><?=$adata['a_author'];?><? } ?><br>
<?=MSG_a_origin;?>:
<?  if ($adata['a_origin']) { ?><a href="<?=$adata['a_originurl'];?>" target=_blank><?=$adata['a_origin'];?></a><? }
else { ?><a href="<?=$GLOBALS['opt_url'];?>"><?=$GLOBALS['opt_title'];?></a><? } ?><br>
<? if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) { ?><?=MSG_a_publisher;?>: <?=user_out($pdata['p_uname'],$pdata['p_uid']);?><br><? } ?>
<?=$pages;?>
</div><hr><br>
<?=textout($pdata['p_text'],$pdata['p__html'],$pdata['p__bcode'],$pdata['p__smiles'],$pdata['p_tid'],$pdata['p_id']);?><br>
<br><?=$pages;?>
<br><br></td></tr>
<? if ($tdata['t__rate'] && $GLOBALS['inforum']['f_rate']) { ?>
<tr class="basictable"><td>
<? rating($rated,$tdata); ?>
</td></tr>
<? } ?></table><br>
<noindex><div class="modlinks"><a href="index.php?m=article&a=do_print&t=<?=$tdata['t_id'];?>"><?=MSG_a_print;?></a> |
<a href="index.php?m=misc&a=friend&t=<?=$tdata['t_id'];?>"><?=MSG_t_mailtofriend;?></a>
<? if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_ltopic']) { ?> | <a href="index.php?m=article&a=add_article&f=<?=$GLOBALS['forum'];?>"><?=MSG_a_add;?></a>
<?  }
if (($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_ledit'] && $GLOBALS['intopic']['t_author']==$GLOBALS['inuserid']) || $GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) { ?> | <a href="index.php?m=article&a=edit_article&t=<?=$tdata['t_id'];?>"><?=MSG_a_edit;?></a>
<? }
if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) { ?>
 |
<a href="index.php?m=article&a=delete_confirm&t=<?=$tdata['t_id'];?>"><?=MSG_a_delete;?></a> |
<a href="index.php?m=moderate&a=split_topic&t=<?=$tdata['t_id'];?>"><?=MSG_a_split;?></a>
<? } ?></div></noindex>
<? }

function article_discuss_start() {
?><br><table class="innertable" width=100% cellspacing=1><tr><td class="tablehead">
<?=MSG_a_discussion;?></td></tr>
<? }

function article_discuss_entry(&$entry) {
?><tr class="basictable"><td><noindex><div class="descr"><?=user_out($entry['p_uname'],$entry['p_uid']);?>,
<?=long_date_out($entry['p__time']);?>
<? if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lip']) { ?> IP: <?=numtoip($entry['p__ip']);?><? }
if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate'] || ($GLOBALS['inuserid']==$entry['p_uid'] && $GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_ledit'])) {
?> <a href="index.php?a=edit_comment&t=<?=$GLOBALS['topic'];?>&p=<?=$entry['p_id'];?>"><?=MSG_edit;?></a><?
}
if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) { ?>
 | <a href="index.php?a=do_delete_comment&t=<?=$GLOBALS['topic'];?>&p=<?=$entry['p_id'];?>"><?=MSG_delete;?></a>
<? if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lmoderate']) { ?>
 | <a href="index.php?m=profile&a=warn&t=<?=$pdata['p_tid'];?>&u=<?=$pdata['p_uid'];?>"><?=MSG_p_reputation;?></a>
<?  }
 } ?></div></noindex><br>
<?=textout($entry['p_text'],$entry['p__html'],$entry['p__bcode'],$entry['p__smiles'],$entry['p_tid'],$entry['p_id']);?>
</td></tr>
<? }

function article_discuss_end($dtid) {
if ($dtid) { ?>
<tr><td class="tablehead"><a class="inverse" href="index.php?t=<?=$dtid;?>"><?=MSG_a_gotodisc;?></a></td></tr>
<? } ?>
</table>
<? }

function article_discuss_form(&$pdata,$msg,$newaction) {
$inforum=$GLOBALS['inforum'];
?><br><noindex><form name=postform action="index.php" method=POST>
<table class="innertable" width=100% cellspacing=1><tr><td class="tablehead" colspan=2>
<?=$msg;?></td></tr>
<? if ($GLOBALS['inuserid']<=3) quick_login_form(); ?>
<? if ($GLOBALS['inforum']['f_rules']) { ?>
<tr class="basictable"><td colspan=2><?=MSG_a_commentrules;?> <a href="index.php?a=f_rules&f=<?=$GLOBALS['forum'];?>"><?=MSG_a_ruleslink;?></a></td></tr>
<? }
common_post($pdata,MSG_a_discusstext);?>
<tr class="basictable"><td><?=MSG_a_discussoptions;?></td><td>
<? if ($GLOBALS['inuserlevel']>=$inforum['f_lhtml']) { ?>
<input type=checkbox value=1 name=p__html <? check($pdata['p__html']);?>><?=MSG_p_usehtml;?>?<br>
<? } ?>
<? if ($inforum['f_bcode']) { ?>
<input type=checkbox value=1 name=p__bcode <? check($pdata['p__bcode']);?>><?=MSG_p_usebcode;?>?<br>
<? }
if ($inforum['f_smiles']) { ?>
<input type=checkbox value=1 name=p__smiles <? check($pdata['p__smiles']==1);?>><?=MSG_p_usesmiles;?>?</td></tr>
<? } ?>
<tr><td class="tablehead" colspan=2><input type=hidden name=m value=article>
<input type=hidden name=a value=<?=$newaction;?>><input type=hidden name=t value=<?=$GLOBALS['topic'];?>>
<input type=hidden name=p value=<?=getvar("p");?>><input type=submit value="<?=MSG_post;?>">
</td></tr></table></form></noindex>
<? }

function article_edit_form(&$tdata,&$adata,&$pdata,$newaction,$msg,$forumlist="") {
$inforum=$GLOBALS['inforum'];
?><form name=postform action="index.php" method=POST>
<table class="innertable" width=100% cellspacing=1><tr><td class="tablehead" colspan=2>
<?=$msg;?></td></tr>
<? if ($GLOBALS['inuserid']<=3) quick_login_form(); ?>
<tr class="basictable"><td width=50%><?=MSG_a_title;?></td><td>
<input type=text name=t_title size=30 maxlength=60 value="<?=$tdata['t_title'];?>"></td></tr>
<tr class="basictable"><td><?=MSG_a_descr;?></td><td>
<textarea name=t_descr rows=4 cols=30><?=textarea($tdata['t_descr']);?></textarea></td></tr>
<tr class="basictable"><td><?=MSG_a_author;?></td><td>
<input type=text name=a_author size=30 maxlength=64 value="<?=$adata['a_author'];?>">
</td></tr>
<tr class="basictable"><td><?=MSG_a_authormail;?><br><?=MSG_a_amaildescr;?></td><td>
<input type=text name=a_authormail size=30 maxlength=48 value="<?=$adata['a_authormail'];?>"></td></tr>
<tr class="basictable"><td><?=MSG_a_origin;?><br><?=MSG_a_origindescr;?></td><td>
<input type=text name=a_origin value="<?=$adata['a_origin'];?>"></td></tr>
<tr class="basictable"><td><?=MSG_a_originurl;?></td><td>
<input type=text name=a_originurl value="<?=$adata['a_originurl'];?>"></td></tr>
<?
if ($GLOBALS['inuserlevel']>=$GLOBALS['inforum']['f_lhtml'] && $GLOBALS['inuser']['u_extform'] && is_dir($GLOBALS['opt_dir']."/fckedit")) {
  $text=$pdata['p_text'];
  $text=str_replace("\r","",$text);
  $text=str_replace("\"","\\\"",$text);
  $text=str_replace("\n","\"\n+\"\\n",$text);
?>
<tr class="basictable"><td colspan=2>
<script type="text/javascript" src="./fckedit/fckeditor.js"></script>
<script type="text/javascript">
  var oFCKeditor=new FCKeditor('p_text') ;
  oFCKeditor.BasePath="<?=$GLOBALS['opt_url'];?>/fckedit/";
  oFCKeditor.Value="<?=$text;?>";
  oFCKeditor.Height=600;
        oFCKeditor.Config["AutoDetectLanguage"]=false;
        oFCKeditor.Config["DefaultLanguage"]="<?=substr($GLOBALS['inuser']['ln_locale'],0,2);?>";
  oFCKeditor.Create();
</script></td></tr>
<? } else {
common_post($pdata,MSG_a_text);
} ?>
<tr class="basictable"><td>
<?=MSG_p_options;?>:
</td><td>
<? if ($GLOBALS['inuserlevel']>=$inforum['f_lhtml'] && $GLOBALS['inuser']['u_extform'] && is_dir($GLOBALS['opt_dir']."/fckedit")) { ?>
<input type=hidden value=1 name=p__html>
<? }
elseif ($GLOBALS['inuserlevel']>=$inforum['f_lhtml']) { ?>
<input type=checkbox value=1 name=p__html <? check($pdata['p__html']);?>><?=MSG_p_usehtml;?>?<br>
<? } ?>
<input type=checkbox value=1 name=nobr <? check($pdata['p__html']);?>><?=MSG_a_nobr;?><br>
<? if ($inforum['f_bcode']) { ?>
<input type=checkbox value=1 name=p__bcode <? check($pdata['p__bcode']==1);?>><?=MSG_p_usebcode;?>?<br>
<? }
if ($inforum['f_smiles']) { ?>
<input type=checkbox value=1 name=p__smiles <? check($pdata['p__smiles']==1);?>><?=MSG_p_usesmiles;?>?<br>
<? }
if ($newaction=="do_topic" && $inforum['f_rate']) { ?>
<input type=checkbox value=1 name=t__rate checked><?=MSG_t_israted;?><br>
</td></tr>
<tr class="basictable"><td><?=MSG_a_discuswhere;?></td>
<td><select name=fid><option value=""><?=MSG_a_here;?><?=$forumlist;?></select>
<? } ?>
</td></tr><tr><td class="tablehead" colspan=2>
<input type=hidden name=m value=article>
<input type=hidden name=a value="<?=$newaction;?>">
<input type=hidden name=f value="<?=$GLOBALS['forum'];?>">
<input type=hidden name=t value="<?=$GLOBALS['topic'];?>">
<input type=submit value="<?=MSG_post;?>">
</td></tr></table></form></noindex>
<?  }

function article_print_form(&$tdata,&$adata,&$pdata) { ?>
<H3><?=MSG_t_print;?></H3>
<H4>- &nbsp; <?=$GLOBALS['opt_title'];?> <?=$GLOBALS['opt_url'];?><br>
-- &nbsp;<?=$GLOBALS['inforum']['f_title'];?> <?=$GLOBALS['opt_url']."/index.php?f=".$GLOBALS['forum'];?><br>
--- <?=$GLOBALS['intopic']['t_title'];?> <?=$GLOBALS['opt_url']."/index.php?t=".$GLOBALS['topic'];?></H4><br><br>
<table width=90% border=0 align=center><tr><td style="text-align: right">
<?=MSG_a_author;?>: <?=$adata['a_author'];?> <?
if ($adata['a_authormail']) { ?>(<?=$adata['a_authormail'];?>)<? } ?>
<br>
<?=MSG_a_origin;?>: <?=$adata['a_origin'];?> <?=$adata['a_originurl'];?>
</td></tr><tr><td>
<hr><br>
<?=textout($pdata['p_text'],$pdata['p__html'],$pdata['p__bcode'],$pdata['p__smiles'],$pdata['p_tid'],$pdata['p_id']);?>
<br><br><br>
<hr>
</td></tr></table>
<center><?=$GLOBALS['opt_copyright'];?><br>
<?=MSG_forum_powered;?><br>
&copy; <?=MSG_forum_copyright;?> http://intboard.ru</center>
<? }
