コード例 #1
0
ファイル: yorumlar.php プロジェクト: ComEnYns/Web-Projects
function tabyaz($aktif)
{
    global $sb;
    global $db;
    global $satirsayi;
    global $aktifssayi;
    global $pasifssayi;
    global $toplamaktifkayit;
    global $toplampasifkayit;
    global $toplamaktifsayfa;
    global $toplampasifsayfa;
    global $makale;
    $ssayi = $pasifssayi;
    $toplamkayit = $toplampasifkayit;
    $toplamsayfa = $toplampasifsayfa;
    if ($aktif) {
        $ssayi = $aktifssayi;
        $toplamkayit = $toplamaktifkayit;
        $toplamsayfa = $toplamaktifsayfa;
    }
    $sql = "SELECT yorumlar.* FROM yorumlar INNER JOIN makaleler ON makaleler.id = yorumlar.mid AND makaleler.kullanici = " . $_SESSION['user']['id'] . " WHERE {$makale} " . ($aktif ? 'yorumlar.aktif' : 'NOT yorumlar.aktif') . " ORDER BY yorumlar.tarih " . ($aktif ? 'DESC' : '') . " LIMIT " . ($aktifssayi - 1) * $satirsayi . ", " . $satirsayi;
    $rs = $db->query($sql);
    ?>
        <table class="table table-hover">
            <thead>
                <tr>
                    <th class="xs-kapat">Tarih</th>
                    <th>Yorum</th>
                    <th class="xs-kapat">Yazar</th>
                    <th class="text-right"></th>
                </tr>
            </thead>
            <tbody>
                <?php 
    while ($row = $rs->fetch_assoc()) {
        ?>
                        <tr>
                            <td class="text-muted xs-kapat"><?php 
        echo date($sb['tarihsaatformat'], strtotime($row['tarih']));
        ?>
</td>
                            <td><span class="liste-uzun-metin"><?php 
        echo sql_filtre(htmlspecialchars($row['yorum']), TRUE);
        ?>
</span></td>
                            <td class="xs-kapat"><?php 
        echo sql_filtre(htmlspecialchars($row['isim']));
        ?>
</td>
                            <td class="text-right">
                                <?php 
        if ($_GET['sayfa'] == 'yorumlar') {
            ?>
                                            <a href="?sayfa=makale&id=<?php 
            echo $row['mid'];
            ?>
" class="btn btn-xs btn-warning" data-toggle="tooltip" data-placement="top" title="İlgili Makaleyi Aç"><i class="fa fa-link"></i></a>
                                <?php 
        }
        ?>
                                <a href="javascript:;" class="btn btn-xs btn-info yorumdetay" data-toggle="modal" data-target="#yorumdetay"><i class="fa fa-edit" data-toggle="tooltip" data-placement="top" title="Tamamını Oku"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-danger yorumsil" data-toggle="tooltip" data-placement="top" title="Sil" data-yorum-id="<?php 
        echo $row['id'];
        ?>
" data-tab="<?php 
        echo $aktif ? 1 : 0;
        ?>
"><i class="fa fa-trash-o"></i></a>
                                <a href="javascript:;" class="btn btn-xs btn-<?php 
        echo $aktif ? 'success' : 'default';
        ?>
 aktifdegistir" data-toggle="tooltip" data-placement="top" title="Aktif/Pasif" data-yorum-id="<?php 
        echo $row['id'];
        ?>
" data-tab="<?php 
        echo $aktif ? 1 : 0;
        ?>
"><i class="fa fa-circle"></i></a>
                            </td>
                        </tr>
                <?php 
    }
    ?>
            </tbody>
        </table>
        
        <?php 
    if ($toplamsayfa > 1) {
        ?>
                    <div class="row">
                        <div class="col-xs-12">
                            <div class="pull-right">
                                <ul class="pagination">
                                    <li class="<?php 
        echo $ssayi == 1 ? 'disabled' : '';
        ?>
"><a href="?sayfa=<?php 
        echo $_GET['sayfa'];
        ?>
&id=<?php 
        echo $_GET['id'];
        ?>
&atab=<?php 
        echo $aktif ? 1 : 0;
        ?>
&aktifssayi=<?php 
        echo $aktifssayi - ($aktif ? 1 : 0);
        ?>
&pasifssayi=<?php 
        echo $pasifssayi - ($aktif ? 0 : 1);
        ?>
">&laquo;</a></li>
                                    <?php 
        for ($i = 1; $i <= $toplamsayfa; $i++) {
            ?>
                                                <li class="<?php 
            echo $ssayi == $i ? 'active' : '';
            ?>
"><a href="?sayfa=<?php 
            echo $_GET['sayfa'];
            ?>
&id=<?php 
            echo $_GET['id'];
            ?>
&atab=<?php 
            echo $aktif ? 1 : 0;
            ?>
&aktifssayi=<?php 
            echo !$aktif ? $aktifssayi : $i;
            ?>
&pasifssayi=<?php 
            echo !$aktif ? $i : $pasifssayi;
            ?>
"><?php 
            echo $i;
            ?>
</a></li>
                                    <?php 
        }
        ?>
                                    <li class="<?php 
        echo $ssayi == $toplamsayfa ? 'disabled' : '';
        ?>
"><a href="?sayfa=<?php 
        echo $_GET['sayfa'];
        ?>
&id=<?php 
        echo $_GET['id'];
        ?>
&atab=<?php 
        echo $aktif ? 1 : 0;
        ?>
&aktifssayi=<?php 
        echo $aktifssayi + ($aktif ? 1 : 0);
        ?>
&pasifssayi=<?php 
        echo $pasifssayi + ($aktif ? 0 : 1);
        ?>
">&raquo;</a></li>
                                </ul>
                            </div>
                        </div>
                    </div>
<?php 
    }
}
コード例 #2
0
ファイル: index.php プロジェクト: ComEnYns/Web-Projects
/*
**  Basit Blog 1.0.0
**  https://github.com/hozakar/basitblog
**
**  Copyright 2014, Hakan Özakar
**  http://beltslib.net
**
**  CC0 1.0 Universal Licence ile lisanslanmıştır
**  https://creativecommons.org/publicdomain/zero/1.0/
*/
include "yonetim/inc/sistem/functions.php";
if ($_POST['yorum']) {
    $mid = current($db->query("SELECT id FROM makaleler WHERE url = '{$_REQUEST['url']}'")->fetch_row());
    if ($mid) {
        $db->query("INSERT INTO yorumlar (mid, yorum, isim, eposta, web) VALUES(\n                {$mid},\n                '" . sql_filtre(htmlspecialchars(s_addslashes($_POST['yorum']))) . "',\n                '" . sql_filtre(htmlspecialchars(s_addslashes($_POST['isim']))) . "',\n                '" . sql_filtre(htmlspecialchars(s_addslashes($_POST['eposta']))) . "',\n                '" . sql_filtre(htmlspecialchars(s_addslashes($_POST['web']))) . "'\n            )");
    }
    header('location: ' . $site->sb['anadizin'] . $_REQUEST['url'] . '.html');
    return;
}
if ($_REQUEST['url']) {
    $site->makale($_REQUEST['url']);
    $dosya = getDir('index.php') . "yonetim/sablon/" . $site->url['sablon'];
} else {
    $dosya = getDir('index.php') . "yonetim/sablon/" . $anasayfasablon;
}
/* Log tutalım ileride lazım olur... */
$log_sayfa = 'anasayfa';
if ($_GET['ara']) {
    $log_sayfa = 'arama';
    $log_terim = $_GET['ara'];
コード例 #3
0
 private function bicimlendir($isim, $deger)
 {
     switch ($isim) {
         case 'tarih':
             $deger = date($this->sb['tarihformat'], strtotime($deger));
             break;
         case 'tarihsaat':
             $deger = date($this->sb['tarihsaatformat'], strtotime($deger));
             break;
         case 'kisametin':
         case 'ortametin':
         case 'uzunmetin':
             $deger = strip_tags($deger);
             $deger = str_replace(array(chr(13), chr(9), chr(10)), ' ', $deger);
             $deger = str_replace('  ', ' ', trim($deger));
             $deger = explode(' ', $deger, $this->sb[$isim] + 1);
             $comma = '';
             if (count($deger) > $this->sb[$isim]) {
                 array_pop($deger);
                 $comma = '...';
             }
             $deger = implode(' ', $deger) . $comma;
             break;
         case 'url':
             $deger = $this->sb['anadizin'] . $deger . '.html';
             break;
         case 'anadizin':
             $deger = $this->sb['anadizin'];
             break;
         case 'gravatar':
             $deger = "http://www.gravatar.com/avatar/" . md5(strtolower(trim($deger))) . "?s=120";
             break;
     }
     return sql_filtre($deger, TRUE);
 }