Advertisement
Guest User

news_by_Envolvents

a guest
Oct 4th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.62 KB | None | 0 0
  1. <html lang="pt">
  2. <head>
  3. <?php
  4.     // error_reporting(0); # remove syntax errors (VertrigoServ / XAMP and others)
  5.    
  6.     DEFINE( 'HOST', 'localhost' );  # Padrão
  7.     DEFINE( 'USER', 'root' );       # Usuário do pma
  8.     DEFINE( 'PASS', 'vertrigo' );   # Senha do pma
  9.     DEFINE( 'DATABASE', 'board' );  # Nome da database do fórum
  10.     DEFINE( 'BOARD', '/forum/' );   # link do seu fórum
  11.     DEFINE( 'LIMIT', '5');          # Limite de Notícias que será exibida
  12.     DEFINE( 'CATEGORY1', '2');      # ID da categoria dos Eventos (coluna forum_id = %)
  13.     DEFINE( 'CATEGORY2', '4');      # ID da categoria das Changelogs da Staff (coluna forum_id = %)
  14.     DEFINE( 'CATEGORY3', '6');      # ID da categoria de Noticías da Staff (coluna forum_id = %)
  15.    
  16.     try {
  17.         $pdo = new PDO("mysql:dbname=".DATABASE.";host=".HOST, USER, PASS);
  18.         $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  19. //         $pdo->exec("SET NAMES utf8");
  20.        
  21.     } catch (PDOException $e) {
  22.         echo "Sua conexão falhou: ".$e->getMessage();
  23.         die();
  24.     }
  25. ?>
  26.     <meta charset="utf-8" />
  27.     <title>Last News IP.Board by Envolvents</title>
  28.     <meta name="viewport" content="initial-scale=1.0; maximum-scale=1.0; width=device-width;">
  29.     <style type="text/css">
  30.     /*
  31.     * Last News IP.Board by Envolvents
  32.     * v.1.0
  33.     * 01/03/2017
  34.     */
  35.  
  36.     @import url(http://fonts.googleapis.com/css?family=Roboto:400,500,700,300,100);
  37.  
  38.     body {
  39.       background-color: #3e94ec;
  40.       font-family: "Roboto", helvetica, arial, sans-serif;
  41.       font-size: 16px;
  42.       font-weight: 400;
  43.       text-rendering: optimizeLegibility;
  44.     }
  45.  
  46.     div.table-title {
  47.        display: block;
  48.       margin: auto;
  49.       max-width: 600px;
  50.       padding:5px;
  51.       width: 100%;
  52.     }
  53.  
  54.     .table-title h3 {
  55.        color: #fafafa;
  56.        font-size: 30px;
  57.        font-weight: 400;
  58.        font-style:normal;
  59.        font-family: "Roboto", helvetica, arial, sans-serif;
  60.        text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.1);
  61.        text-transform:uppercase;
  62.        text-align: center;
  63.     }
  64.  
  65.  
  66.     /*** Table Styles **/
  67.  
  68.     .table-fill {
  69.       background: white;
  70.       border-radius:3px;
  71.       border-collapse: collapse;
  72.       height: 320px;
  73.       margin: auto;
  74.       max-width: 600px;
  75.       padding:5px;
  76.       width: 100%;
  77.       box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
  78.       animation: float 5s infinite;
  79.     }
  80.      
  81.     th {
  82.       color:#D5DDE5;;
  83.       background:#1b1e24;
  84.       border-bottom:4px solid #9ea7af;
  85.       border-right: 1px solid #343a45;
  86.       font-size:23px;
  87.       font-weight: 100;
  88.       padding:24px;
  89.       text-align:left;
  90.       text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
  91.       vertical-align:middle;
  92.     }
  93.  
  94.     th:first-child {
  95.       border-top-left-radius:3px;
  96.     }
  97.      
  98.     th:last-child {
  99.       border-top-right-radius:3px;
  100.       border-right:none;
  101.     }
  102.      
  103.     tr {
  104.       border-top: 1px solid #C1C3D1;
  105.       border-bottom-: 1px solid #C1C3D1;
  106.       color:#666B85;
  107.       font-size:16px;
  108.       font-weight:normal;
  109.       text-shadow: 0 1px 1px rgba(256, 256, 256, 0.1);
  110.     }
  111.      
  112.     tr:hover td {
  113.       background:#4E5066;
  114.       color:#FFFFFF;
  115.       border-top: 1px solid #22262e;
  116.       border-bottom: 1px solid #22262e;
  117.     }
  118.     tr:hover td a {
  119.       color:#FFFFFF;
  120.     }
  121.      
  122.     tr:first-child {
  123.       border-top:none;
  124.     }
  125.  
  126.     tr:last-child {
  127.       border-bottom:none;
  128.     }
  129.      
  130.     tr:nth-child(odd) td {
  131.       background:#EBEBEB;
  132.     }
  133.      
  134.     tr:nth-child(odd):hover td {
  135.       background:#4E5066;
  136.     }
  137.  
  138.     tr:last-child td:first-child {
  139.       border-bottom-left-radius:3px;
  140.     }
  141.      
  142.     tr:last-child td:last-child {
  143.       border-bottom-right-radius:3px;
  144.     }
  145.      
  146.     td {
  147.       background:#FFFFFF;
  148.       padding:20px;
  149.       text-align:left;
  150.       vertical-align:middle;
  151.       font-weight:300;
  152.       font-size:18px;
  153.       text-shadow: -1px -1px 1px rgba(0, 0, 0, 0.1);
  154.       border-right: 1px solid #C1C3D1;
  155.     }
  156.  
  157.     td a {
  158.       color: #666B85;
  159.       text-decoration: underline;
  160.     }
  161.     td:last-child {
  162.       border-right: 0px;
  163.     }
  164.  
  165.     th.text-left {
  166.       text-align: left;
  167.     }
  168.  
  169.     th.text-center {
  170.       text-align: center;
  171.     }
  172.  
  173.     th.text-right {
  174.       text-align: right;
  175.     }
  176.  
  177.     td.text-left {
  178.       text-align: left;
  179.     }
  180.  
  181.     td.text-center {
  182.       text-align: center;
  183.     }
  184.  
  185.     td.text-right {
  186.       text-align: right;
  187.     }
  188.     </style>
  189. </head>
  190. <body>
  191.     <div class="table-title">
  192.         <h3>Noticias IP.B 3.4.x by Ferraz</h3>
  193.     </div>
  194.     <table class="table-fill">
  195.         <thead>
  196.             <tr>
  197.                 <th class="text-left">&nbsp;</th>
  198.                 <th class="text-left">Data</th>
  199.                 <th class="text-left">Título</th>
  200.                 <th class="text-left">Autor</th>
  201.                 <th class="text-left">Acesse</th>
  202.             </tr>
  203.         </thead>
  204.         <tbody class="table-hover">
  205.             <?php
  206.                 $sql = $pdo->prepare("
  207.                             SELECT *,
  208.                             CASE forum_id
  209.                             WHEN ".CATEGORY1." THEN 'News'
  210.                             WHEN ".CATEGORY2." THEN 'Changelogs'
  211.                             WHEN ".CATEGORY3." THEN 'Eventos'
  212.                             END as forum_id
  213.                             FROM topics
  214.                             WHERE forum_id IN ( '".CATEGORY1."', '".CATEGORY2."','".CATEGORY3."')
  215.                             ORDER BY `tid`
  216.                             DESC LIMIT 0, ".LIMIT." ");
  217.                 $sql->execute();
  218.                 if(count($sql) > 0) {
  219.                     foreach ($sql->fetchAll() as $app) {
  220.                         $date = date("d/m", $app['start_date']);
  221.                         echo( "<tr>");
  222.                         echo( "<td class=\"text-left\"><img src=\"{$app['forum_id']}.png\"></td>");
  223.                         echo( "<td class=\"text-left\">{$date}</td>");
  224.                         echo( "<td class=\"text-left\">{$app['title']}</td>");
  225.                         echo( "<td class=\"text-left\">{$app['starter_name']}</td>");
  226.                         echo( "<td class=\"text-left\"><a href=\"" . BOARD . "index.php?/topic/{$app['tid']}-{$app['title_seo']}\" class=\"tipsyTIP\" title=\"Clique para ver a notícia completa.\" target=\"_blank\">[mais ...]</a></td>");
  227.                         echo( "</tr>");
  228.                     }
  229.                 } else {
  230.                     echo("<tr>");
  231.                     echo("<td class=\"text-left\" colspan=\"5\" style=\"text-align:center;\">Não há notícias.</td>");
  232.                     echo("</tr>");
  233.                 }
  234.             ?>
  235.         </tbody>
  236.     </table>
  237. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement