Exemple #1
0
 function getCommentsLoop()
 {
     if (!isset($loop_comment_query)) {
         $loop_comment_query = "SELECT * FROM c_comments WHERE post_id = {$this->post_id} AND status <> 'Trashed' ORDER BY date";
     }
     if (!isset($this->i)) {
         $this->res = $this->conn->query($loop_comment_query);
         dbQueryCheck($this->res, $this->conn);
         $this->i = 'set';
     }
     return $this->res->fetch_assoc();
 }
Exemple #2
0
 static function getMailOptions()
 {
     $conn = MySQL::open_conn();
     $query = "SELECT * FROM c_options WHERE option_name LIKE 'smtp%'";
     $res = $conn->query($query);
     dbQueryCheck($res, $conn);
     $smtp_op = [];
     while ($row = $res->fetch_assoc()) {
         $smtp_op[$row['option_name']] = $row['option_value'];
     }
     return $smtp_op;
 }
Exemple #3
0
    ob_end_clean();
    redirectTo('index.php?switch=comments');
}
if (isset($_GET['sub']) && $_GET['sub'] == 'trash_comment') {
    $id = $_GET['id'];
    $query = "UPDATE c_comments SET status = 'Trashed' WHERE ID = {$id} LIMIT 1";
    $res = $conn->query($query);
    dbQueryCheck($res, $conn);
    ob_end_clean();
    redirectTo('index.php?switch=comments');
}
if (isset($_GET['sub']) && $_GET['sub'] == 'clean_comment') {
    $id = $_GET['id'];
    $query = "UPDATE c_comments SET status = 'Published' WHERE ID = {$id} LIMIT 1";
    $res = $conn->query($query);
    dbQueryCheck($res, $conn);
    ob_end_clean();
    redirectTo('index.php?switch=comments');
}
?>
<style>
    #tablediv {
        display:flex;
        justify-content:center;
        align-items:center;
    }

    th {
        text-align: center;
        vertical-align: middle;
    }
Exemple #4
0
function getCategoryLinkNameById($cat_id)
{
    $id = $cat_id;
    $conn = MySQL::open_conn();
    $query = "SELECT link_name FROM c_categories WHERE ID = {$id}";
    $res = $conn->query($query);
    dbQueryCheck($res, $conn);
    $row = $res->fetch_assoc();
    $conn->close();
    return $row['link_name'];
}
Exemple #5
0
 static function verifyUser($username, $password)
 {
     $username = test_input($username);
     $password = test_input($password);
     $conn = MySQL::open_conn();
     $query = "SELECT * FROM c_users WHERE user_login = '******' LIMIT 1";
     $res = $conn->query($query);
     dbQueryCheck($res, $conn);
     $row = $res->fetch_assoc();
     $hpassword = $row['user_pass'];
     $res->free();
     $conn->close();
     $stat = passwordVerify($password, $hpassword);
     if ($stat) {
         return true;
     } else {
         return false;
     }
 }
Exemple #6
0
 function getSearchResultLoop($s, $max_pp = null)
 {
     if (!isset($this->p)) {
         $s = $this->conn->real_escape_string(urldecode($s));
         $loop_first_search_query = "SELECT * FROM c_posts WHERE (post_content LIKE '%{$s}%' OR post_excerpt LIKE '%{$s}%' OR post_title LIKE '%{$s}%' OR post_description LIKE '%{$s}%' OR link_title LIKE '%{$s}%' OR tags LIKE '%{$s}%') AND post_status <> 'Initialized'";
         $this->res = $this->conn->query($loop_first_search_query);
         dbQueryCheck($this->res, $this->conn);
         $this->search_res_count = $this->res->num_rows;
         // set search result count, should be accessed only after function call
         $this->p = 'set';
     }
     if (!isset($loop_search_query)) {
         $s = $this->conn->real_escape_string(urldecode($s));
         $pagination = new Pagination($max_pp, $this->search_res_count);
         $loop_search_query = "SELECT * FROM c_posts WHERE (post_content LIKE '%{$s}%' OR post_excerpt LIKE '%{$s}%' OR post_title LIKE '%{$s}%' OR post_description LIKE '%{$s}%' OR link_title LIKE '%{$s}%' OR tags LIKE '%{$s}%') AND post_status <> 'Initialized' ";
         $loop_search_query .= "LIMIT {$pagination->per_page} ";
         $loop_search_query .= "OFFSET {$pagination->offset()}";
     }
     if (!isset($this->j)) {
         $this->res = $this->conn->query($loop_search_query);
         dbQueryCheck($this->res, $this->conn);
         $this->j = 'set';
     }
     $this->total_pages = $pagination->totalPages();
     $this->hasPreviousPage = $pagination->hasPreviousPage();
     $this->hasNextPage = $pagination->hasNextPage();
     $this->previousPage = $pagination->previousPage();
     $this->nextPage = $pagination->nextPage();
     return $this->res->fetch_assoc();
 }