<?php
  ///////////////////////////////////////////////////
  //Журнал изменений
  //2010 (C)
  //Карпухин Павел
  ///////////////////////////////////////////////////

  $lang = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0,2);
  if(is_file ("../lang/".$lang.".php")) include "../lang/".$lang.".php";
     else include "../lang/ru.php";

  $title=$titlepage = $TEXT['know-izm'];
  $helppage = $TEXT['zhurn-print-tit'];

  require_once "../config.php";
  require_once "top.php";
  ?>
  <title><?php echo $title; ?></title>
  <link rel="StyleSheet" type="text/css" href="../utils/grid.css" />
  <link rel="shortcut icon" href="../Favicon/know-base.ico" type="image/x-icon" />
  </head>
  <body leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" bottommargin="0" topmargin="0" >
  <?php
  if(!isset($button)) $button = $TEXT['zhurn-print-btn'];
  if(!isset($action)) $action = "zhurn_print.php";

  if(empty($_POST['zh_str_id'])) puterror2($TEXT['error-zhurn1']);
  if(strlen($_POST['zh_str_id'])>11) puterror2($TEXT['error-zhurn2']);
?>
<table align="right">
  <tr><td><img align="bottom" alt="Logo" title='<?php echo $TEXT['global-title']; ?>' src="../img/logo.png" /></td><td class="logo"><?php echo $TEXT['global-title']; ?>&nbsp;<span class="logover">(<?php echo $TEXT['maker8']; ?>)</span></td></tr>
  <tr><td></td><td class="logo"><?php echo $TEXT['know-izm']; ?></td></tr>
  <tr><td></td><td>&nbsp;</td></tr>
</table>
<br />
<?php
//function disabled by php > 5.5.3
////import_request_variables("gP", "in_");
// before using only ->  while(list($id,$value) = @each($in_printitem))
 while(list($id2,$value2) = @each($_POST)) {
  if($id2 == "printitem") {
   while(list($id,$value) = each($value2)) {
     if($id > 0 && $value == 'on')
     {
      $query4 = "SELECT
    tbl_bd_zhnaniy.*,
    YEAR(tbl_bd_zhnaniy.data) AS data_year,
    MONTH(tbl_bd_zhnaniy.data) AS data_month,
    DAY(tbl_bd_zhnaniy.data) AS data_day,
    TIME(tbl_bd_zhnaniy.data) AS data_hour,
    tbl_logins.fullname,
    tbl_kritichnost.pic_krit,
    tbl_kritichnost.kritichnost
    FROM tbl_bd_zhnaniy
    JOIN tbl_logins ON tbl_bd_zhnaniy.login_id=tbl_logins.login_id
    JOIN tbl_kritichnost ON tbl_bd_zhnaniy.krit_id=tbl_kritichnost.krit_id
    WHERE tbl_bd_zhnaniy.zhurn_id = ".$id."
    ORDER BY tbl_bd_zhnaniy.position, tbl_bd_zhnaniy.data ";
    $tmp4 = mysql_query($query4);
     if(!$tmp4) puterror2(mysql_error());
      $num_rows = mysql_num_rows($tmp4);
        if($num_rows == 0)
          {
           echo "<h1 class='userpage'><br />&nbsp;&nbsp;".$TEXT['zhurn-nodata']."</h1>";
          }
           else
           {
 ?>
      <table border="0" width="90%" cellpadding="0" cellspacing="0"  align="center">
       <tr>
         <td></td>
         <td></td>
         <td></td>
         <td></td>
         <td></td>
       </tr>
       <?php
           while($sost4 = mysql_fetch_array($tmp4,MYSQL_ASSOC))
           {
            if(!empty($sost4['pic_krit']) && $sost4['pic_krit']!="-") $krit_image = "<img alt='".$sost4['kritichnost']."' title='".$sost4['kritichnost']."' src='".$sost4['pic_krit']."' />";
              else $krit_image = $sost4['kritichnost'];

           $date_day = $sost4['data_day'];
           $date_month = $sost4['data_month'];
           $date_year = $sost4['data_year'];
           $date_time = $sost4['data_hour'];
           if($sost4['data_year'] == "" || $sost4['data_year'] == "0000") $data_r = "---";
            else $data_r = $date_day." ".$month[$date_month]." ".$date_year." ".$TEXT['year']." ".$date_time;

          $sost4['zh_soobschenie'] = str_replace(":smile:","<img alt='picture' src='../img/smile.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace(":tongue:","<img alt='picture' src='../img/tongue.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace(":wink:","<img alt='picture' src='../img/wink.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace(":wassat:","<img alt='picture' src='../img/wassat.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace(":sad:","<img alt='picture' src='../img/sad.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace(":crying:","<img alt='picture' src='../img/crying.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace(":angry:","<img alt='picture' src='../img/angry.png' align=middle />",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = str_replace("  ","&nbsp;&nbsp;",$sost4['zh_soobschenie']);
          $sost4['zh_soobschenie'] = rep_back($sost4['zh_soobschenie']);

            if($_POST['print_item'] == 1) $print_ch = "checked";
             else
             {
              if($sost4['zhurn_id'] == $_POST['zhurn_id']) $print_ch = "checked";
               else $print_ch = "";
             }
             echo "<tr>
              <td></td>
              <td colspan=3 >";
              ?>
             <fieldset class='zayavka_view' >
              <legend align="left" ><span class="temaprint"><?php echo $krit_image; ?>&nbsp;<?php echo $sost4['zh_tema']; ?></span></legend>
               <table align='center' border='0' width='100%' cellpadding='0' cellspacing='0'>
                <tr>
                  <td colspan="2" class="support" width="100%">&nbsp;&nbsp;<?php echo nl2br($sost4['zh_soobschenie']); ?></td>
                </tr>
                <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td class="autor"><?php echo $TEXT['zhurn-autor'].$sost4['fullname']; ?></td>
                  <td class="data"><?php echo $data_r; ?></td>
                </tr>
              </table>
            </fieldset>
       <?php
       echo "</td><td></td>
             </tr>";
            }
            ?>
             <tr>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
              <td></td>
             </tr>
            </table>
           <?php
         }
     }
   }
// added 07.05.2014 //
  }
 }
////
?>
</body>
</html>
