<?php
  /**
   * Index
   *
   * @package Digital Downloads Pro
   * @author wojoscripts.com
   * @copyright 2010
   * @version $Id: index.php, v2.00 2011-07-10 10:12:05 gewa Exp $
   */
  define("_VALID_PHP", true);
  require_once("init.php");
  
  $home = $content->getHomePage();
  $news = $content->renderNews();
  $latest = $item->getLatestProducts();
?>
<?php include("header.php");?>
  <!-- Start Content-->
  <h1><?php echo $home['title'];?></h1>
  <?php echo cleanOut($home['body']);?>
  <?php if($news):?>
  <div class="fullbox">
    <div class="outer">
      <div class="inner">
        <h3><span><?php echo $news['cdate'];?></span><?php echo $news['title'];?></h3>
        <?php echo cleanOut($news['body']);?></div>
    </div>
  </div>
  <div class="fullboxlast"></div>
  <?php endif;?>
  <?php if($latest):?>
  <h2><em>جـدیـد تـریـن محصـولات</em></h2>
  <div id="latest">
    <ul>
      <?php foreach($latest as $lrow):?>
      <?php $status = ($lrow['price'] == 0) ? '<a href="'.SITEURL.'/download.php?fid='.$lrow['pid'].'" class="download-small">دانـلــود</a>' : '<a href="javascript:void(0);" class="add-to-cart" id="item_'.$lrow['pid'].'">اضـافـه بـه سـبـد</a>';?>
      <?php $url = ($core->seo) ? $core->site_url . '/view-item/' . intval($lrow['pid']) . '/' . sanitize($lrow['slug']) . '.html' : $core->site_url . '/item.php?pid=' . intval($lrow['pid']);?>
      <li>
        <div class="box" id="blist_<?php echo $lrow['pid'];?>"> <span class="thumb"> <a href="<?php echo $url;?>"><img src="<?php echo PRODIMGURL . 'thumbs/' . $lrow['thumb'];?>" alt="" title="<?php echo $lrow['title'];?>" id="list_<?php echo $lrow['pid'];?>"/></a> </span> <span class="price"><?php echo $core->formatMoney($lrow['price']);?></span> <strong><a href="<?php echo $url;?>"><?php echo sanitize($lrow['title'],20,'');?></a></strong>
          <p><?php echo sanitize(cleanOut($lrow['description']),100);?></p>
          <em><?php echo $status;?> | <a href="<?php echo $url;?>" class="read-more">ادامه مطلب</a></em> </div>
      </li>
      <?php endforeach;?>
    </ul>
    <div class="clear"></div>
  </div>
  <?php endif;?>
  <!-- End Content/-->
<?php include("footer.php");?>