<!-- Sidepanel -->
<div class="w3-third w3-container">
  <div class="w3-hide-medium w3-hide-large" style="height:32px">
  </div>

<!--Last news box-->
  <div class="w3-container w3-card-2 qet-very-light-gray w3-left-align">
    <p class=w3-small>Last news:</p>
      <?php include_once('../../private/connexion_db.inc.php'); ?>
      <?php
        // display the news
	if ($qet_mysql_ok) {
		$request_news_count = 'SELECT COUNT(*) AS count FROM punbb_topics WHERE forum_id='.$qet_news_forum_id.';';
		$news_count = mysql_query($request_news_count);
                if ($news_count) {
			$news_count = mysql_fetch_assoc($news_count);
			$news_count = $news_count['count'];
			
			// number of news per page
			$news_per_page = 1;
			
			// number of pages
			$max_page_num = ceil($news_count / $news_per_page);
			
			// find the number of the page to be displayed
			$page_number = isset($_GET['page']) && preg_match('/^[0-9]+$/', $_GET['page']) ? $_GET['page'] : 1;
			if ($page_number < 1) $page_number = 1;
			else if ($page_number > $max_page_num) $page_number = $max_page_num;
			
			$requete_news  = 'SELECT t.id, t.subject, p.poster, p.posted, p.message FROM punbb_topics t ';
			$requete_news .= 'LEFT JOIN punbb_posts p ON p.id = t.first_post_id ';
			$requete_news .= 'WHERE forum_id = '.$qet_news_forum_id.' ';
			$requete_news .= 'ORDER BY t.posted DESC ';
			$requete_news .= 'LIMIT '.($page_number - 1) * $news_per_page.', '.$news_per_page.' ;';
			
			$news = mysql_query($requete_news);
			if ($news) {
				while ($new = mysql_fetch_assoc($news)) {
					foreach($new as $cle => $val) if ($cle != 'message') $new[$cle] = htmlentities($val);
      ?>
                                        <!-- display one news -->
    			                <a name="<?=$new['id']?>"></a>
				        <div class="w3-large qet-serif qet-very-light-gray" style="margin-bottom:20px">
                                          <?=$new['subject']?><br />
					  <div class="w3-small">
					    <i>by <span style="font-weight:bold;"><?=$new['poster']?></span> on <?=date('d/m/Y', $new['posted'])."\n"?></i>
					  </div>
				        </div>
      <?php
				}
			}
                }
        }
      ?>
    <a href="news.php" class="w3-small qet-sans qet-text-link qet-hover-text-link">read more...</a>
    <br /><br />
  </div>

  <div style="height:18px;background-color:transparent"></div>

<!--Donation box-->
  <div class="w3-container w3-card-2 qet-gray">
    <div class="w3-xxxlarge w3-left" style="margin-right:12px"><i class="fa fa-cc-paypal"></i></div>
    <p class="w3-left-align">If you appreciate this software, please make a donation!</p>
      <div class="w3-center" style="margin-bottom:10px">
        <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
          <input type="hidden" name="cmd" value="_s-xclick">
          <input type="hidden" name="hosted_button_id" value="ZZHC9D7C3MDPC">
          <input id="donate" type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal">
            <img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1"/>
        </form>
      </div>
  </div>

  <div style="height:18px;background-color:transparent"></div>

<!--Companies support box-->
  <div class="w3-container w3-card-2 qet-white">
    <p class="w3-small w3-left-align">Companies supporting QElectroTech:</p>
    <div class="w3-center">
      <a href="http://www.soliton.com.br/" target="_blank" class="w3-image w3-btn qet-white"><img src="../images-design/logo-soliton.jpg" alt="soliton logo" style="width:100%"/></a>
      <br /><br />
      <div class="w3-left">
        <a href="support-us.php" class="w3-small qet-text-link qet-hover-text-link">learn more...</a>
      </div>
      <br /><br />
    </div>
  </div>

  <div style="height:18px;background-color:transparent"></div>

<!--Open source partners box-->
  <div class="w3-container w3-card-2 qet-white">
    <p class="w3-small w3-left-align">Our open source partners:</p>
    <div class="w3-center">
      <a href="https://www.tuxfamily.org/" target="_blank" class="w3-image w3-btn qet-margb-12 qet-white"><img src="../images-design/logo-tuxfamily.png" alt="tuxfamily logo" style="width:100%"/></a>

      <a href="https://www.gnu.org/" target="_blank" class="w3-image w3-btn qet-margb-12 qet-white"><img src="../images-design/logo-werungnu.png" alt="we run gnu logo" style="width:100%"/></a>

      <a href="https://www.ilovefreesoftware.com/27/windows/free-software-draw-electrical-circuit-design-qelectrotech.html" target="_blank" class="w3-image w3-btn qet-white"><img src="../images-design/logo-ilovefreesoftware.png" alt="ILFS logo" style="width:100%"/></a>
      <br /><br />
    </div>
  </div>

</div>
