Ejemplo n.º 1
0
        if (file_exists($themeSingle)) {
            include $themeSingle;
        } else {
            include 'templates/single.php';
        }
    } else {
        include THEME_PATH . $theme . '/404.php';
    }
    ?>

<?php 
} elseif (isset($_GET['category']) && $_GET['category'] == 'search') {
    ?>

	<?php 
    $posts = searchBlog($_GET['q']);
    // Include search
    $themeSearch = THEME_PATH . $theme . '/blog/search.php';
    if (file_exists($themeSearch)) {
        include $themeSearch;
    } else {
        include 'templates/search.php';
    }
    ?>
	
<?php 
} elseif (isset($_GET['category']) && !is_numeric($_GET['category']) && $_GET['category'] != '') {
    ?>
	
	<?php 
    $posts = listCategoryPosts();
Ejemplo n.º 2
0
 public static function ajax()
 {
     if (isset($_POST['catname'])) {
         $dbh = new CandyDB();
         $sth = $dbh->prepare("INSERT INTO " . DB_PREFIX . "categories (`cat_name`) VALUES ('{$_POST['catname']}')");
         $sth->execute();
         $sth = $dbh->prepare("SELECT cat_id FROM " . DB_PREFIX . "categories WHERE cat_name='{$_POST['catname']}'");
         $sth->execute();
         echo $sth->fetchColumn();
     } elseif (isset($_POST['search'])) {
         $posts = searchBlog($_POST['q']['term']);
         echo json_encode($posts);
     } else {
         $id = $_POST['id'];
         $dbh = new CandyDB();
         $sth = $dbh->prepare("DELETE FROM " . DB_PREFIX . "categories WHERE cat_id={$id}");
         $sth->execute();
     }
 }