Example #1
0
function edit_action($id)
{
    edit_post($id);
    $posts = get_all_posts();
    $html = render_template('View/Templates/admin.php', array('posts' => $posts));
    return $html;
}
function get_all($type, $properties = array())
{
    if ($type == 'user') {
        return get_all_users($properties);
    }
    return get_all_posts($type, $properties);
}
Example #3
0
function update_action($id)
{
    update_post($id);
    $posts = get_all_posts();
    $html = render_template("view/templates/admin.php", array('posts' => $posts));
    return new Response($html);
}
Example #4
0
 public function getData($glob_user)
 {
     include_once "classes/db.class.php";
     $db = new DB();
     $db->Connect();
     include_once "./functions.php";
     $nav_links = '<a href="index.php" class="align_left"><h1>Awesome</h1></a>
                     <ul class="align_left">
                         <li><a href="index.php?web=home">Home</a></li>
                         <li><a href="index.php?web=profile&email=all">Profile</a></li>
                     </ul> 
                     
                     <form class="align_right" method="POST" id="log_out_form">
                         <input type="hidden" name="logging_out" value="bar" />
                         <a href="index.php?web=login" class="align_right logout_link"
                             onclick="document.getElementById(\'log_out_form\').submit(); return false;"
                         ><span class="glyphicon glyphicon-log-out"></span> Log out</a>
                     </form>
                     ';
     $new_post_form = '<form method="POST" class="new_post_form" enctype="multipart/form-data" name="new_post_form" onsubmit="return validate_textarea_newpost()">
                         <textarea rows="4" cols="90" maxlength="1000" name="post_textarea" class="form-control" placeholder="Share your story..."></textarea> 
                         </br>
                         <div style="float:left;">
                             <!--<span class="glyphicon glyphicon-camera" style="font-size:2.5em;"></span>-->
                             <input type="file" name="new_post_file">
                         </div>
                         <div style="float:right;">
                             <input type="submit" value="Send" class="btn btn-primary">
                         </div>
                     </form>';
     /***************************************************************/
     $table = "users";
     $selected_column = "id, name , email, sex, age, address, info, rights, phone";
     $where_arr = array("email" => $glob_user);
     $user_data = $db->DBSelectOne($table, $selected_column, $where_arr);
     $user_avatar = $user_data["id"];
     $user_avatar = file_exists("images/ava/" . $user_avatar . ".png") ? $user_avatar : "unknown";
     $user_infos = '<img class="img-circle with_shadow with_border" src="images/ava/' . $user_avatar . '.png" height="200px" width="200px">
                     <h1>' . $user_data["name"] . '</h1>
                         ' . $user_data["info"];
     $user_sex = $user_data["sex"] == 1 ? "Male" : "Female";
     $user_info_arr = array("sex" => "glyphicon-heart-empty", "age" => "glyphicon-calendar", "phone" => "glyphicon-earphone", "address" => "glyphicon-map-marker", "follow" => "glyphicon-eye-open");
     $user_info_arr_suffix = array("sex" => "", "age" => " years", "phone" => "", "address" => "", "follow" => "followers");
     $more_infos = get_more_info($user_data);
     /******************************* USERS POSTS ***************************************/
     $order_by = array();
     $order_by[] = array("column" => "time", "sort" => "DESC");
     $all_posts_arr = $db->DBSelectAll("posts", "id, users_id, text, time", array(), "", $order_by);
     $all_posts = get_all_posts($db, $all_posts_arr, $db, $user_data);
     $you_may_know = get_may_know($user_data["id"], $db);
     $activities = '<ul>
                         <li><span class="glyphicon glyphicon-heart"></span> <strong>Tony Tran</strong> likes your posts <span class="badge">5</span></li>
                         <li><span class="glyphicon glyphicon-eye-open"></span> <strong>Tony Tran</strong> and <strong>3 people</strong> started to follow you <span class="badge">4</span></li>
                         <li><span class="glyphicon glyphicon-heart"></span> <strong>Kin Le</strong> likes your posts <span class="badge">1</span></li>
                         <li></li>
                     </ul>';
     $copy_right = '<p>Copyright &copy; 2015 Vnkid</p>';
     return array("nav_links" => $nav_links, "user_infos" => $user_infos, "more_infos" => $more_infos, "you_may_know" => $you_may_know, "activities" => $activities, "all_posts" => $all_posts, "copy_right" => $copy_right, "new_post" => $new_post_form);
 }
function admin_action()
{
    if (isset($_POST['submit'])) {
        add_post();
    }
    $posts = get_all_posts();
    $html = render_template('view/templates/admin.php', array('posts' => $posts));
    return $html;
    //require "view/templates/admin.php";
}
function getCategories()
{
    if (get_all_posts()) {
        $temp = array();
        $result = array();
        foreach (get_all_posts() as $post) {
            $temp[trim($post['post_category'])] = true;
        }
        $temp = array_keys($temp);
        sort($temp);
        foreach ($temp as $temp_category) {
            array_push($result, array("url" => BLOG_URL . "category/" . $temp_category, "external" => false, "content" => $temp_category, "children" => false));
        }
        unset($temp);
        return $result;
    }
}
Example #7
0
function list_action()
{
    $posts = get_all_posts();
    $html = render_template('templates/list.php', array('posts' => $posts));
    return new Response($html);
}
Example #8
0
<?php

require "top.php";
$posts = get_all_posts('mainPage');
foreach ($posts as $row) {
    ?>
<article>
<figure>
<a href="./show.php?id=<?php 
    echo $row['id'];
    ?>
"><img src="<?php 
    echo $row['path'];
    ?>
"></a>
</figure>
<figcaption>
<div id="author"><?php 
    echo $row['autor'] . " -- " . $row['book'];
    ?>
</div>
<hr/>
<?php 
    $all = $row['tag'];
    $tags = explode(' ', $all);
    ?>
<div id="from">Added by: <?php 
    echo $row['nick'];
    ?>
</div> <div id="tag"><?php 
    foreach ($tags as $x) {
Example #9
0
<div class="container">
	<a class="add-new-btn" href="<?php 
echo BASE_URL;
?>
admin">+ New Post</a>
	<h1 class="page-title">All Posts</h1>
	<table class="all-posts-table">
		<thead>
			<tr>
				<th>ID</th>
				<th>Post Title</th>
				<th>Edit</th>
				<th>Delete</th>
			</tr>
		</thead>
		<tbody>
			<?php 
$all_posts = get_all_posts();
foreach ($all_posts as $post) {
    echo "<tr>\n\t\t\t\t\t\t\t<td>{$post['post_id']}</td>\n\t\t\t\t\t\t\t<td>{$post['post_title']}</td>\n\t\t\t\t\t\t\t<td class='text-center'><a href='" . BASE_URL . "admin/?page=edit_post&post_id={$post['post_id']}'>Edit</a></td>\n\t\t\t\t\t\t\t<td class='text-center'><a class='delete-btn' data-msg='Do you really want to delete this post?' href='" . BASE_URL . "admin/processors/delete-post.php?post_id={$post['post_id']}'>Delete</a></td>\n\t\t\t\t\t\t</tr>";
}
?>
		</tbody>
	</table>
</div>
Example #10
0
/**
* Mассив $posts содержит выборку всех полей из 
* таблицы post.
* Подгружает файл list.php содержащий вид вывода.
* информации из $posts в браузере.
*/
function list_action()
{
    $posts = get_all_posts();
    require 'View/Templates/list.php';
}
Example #11
0
<h2>Archives</h2>
<?php 
//Get all posts
$archives_all_posts = get_all_posts();
$archives_posts = array();
//echo '<pre>' . print_r($archives_all_posts, TRUE) . '</pre>'; exit();
//
$archives_posts_to_hide = array('archives.md', 'about.md');
if ($archives_all_posts && count($archives_all_posts) > count($archives_posts_to_hide)) {
    ?>
	<?php 
    //If posts are present
    foreach ($archives_all_posts as $key => $archives_post) {
        //Hide special pages
        if (in_array($archives_post['fname'], $archives_posts_to_hide)) {
            continue;
        }
        //Hide drafts
        if ($archives_post['post_status'] == 'draft') {
            continue;
        }
        $archives_posts[$key] = $archives_post;
    }
    if (!empty($archives_posts)) {
        ?>
		<!-- Search box -->
		<p style="text-align: center; margin-top: 3em;">
			<iframe src="http://duckduckgo.com/search.html?site=davidlartey.com&prefill=Search this site" 
				style="overflow:hidden;margin:0;padding:0;width:408px;height:40px;"
				frameborder="0">
			</iframe>
Example #12
0
 public function getData($glob_user, $profile_email)
 {
     include_once "classes/db.class.php";
     $db = new DB();
     $db->Connect();
     include_once "./functions.php";
     $nav_links = '<a href="index.php" class="align_left"><h1>Awesome</h1></a>
                     <ul class="align_left">
                         <li><a href="index.php?web=home">Home</a></li>
                         <li><a href="index.php?web=profile&email=all">Profile</a></li>
                     </ul> 
                     
                     <form class="align_right" method="POST" id="log_out_form">
                         <input type="hidden" name="logging_out" value="bar" />
                         <a href="index.php?web=login" class="align_right logout_link"
                             onclick="document.getElementById(\'log_out_form\').submit(); return false;"
                         ><span class="glyphicon glyphicon-log-out"></span> Log out</a>
                     </form>
                     ';
     $new_post_form = '';
     /***************************************************************/
     if ($profile_email == "all") {
         $my_right = $db->DBSelectOne("users", "rights", array("email" => $glob_user));
         $order_by = array();
         $order_by[] = array("column" => "time", "sort" => "DESC");
         if (isset($_POST["delete_btn"])) {
             foreach ($_POST["check_to_del"] as $value) {
                 delete_user($value, $db);
             }
         }
         $all_profile_arr = $db->DBSelectAll("users", "id, name, email, sex, age, rights", array());
         $all_posts = $this->get_all_profiles($all_profile_arr, $my_right["rights"]);
         $user_data = $db->DBSelectOne("users", "id, name , email, sex, age, address, info, phone", array("email" => $glob_user));
         $user_avatar = file_exists("images/ava/" . $user_data["id"] . ".png") ? $user_data["id"] : "unknown";
         $user_infos = '<img class="img-circle with_shadow with_border" src="images/ava/' . $user_avatar . '.png" height="200px" width="200px">
                         <h1>' . $user_data["name"] . '</h1>' . $user_data["info"];
         $more_infos = get_more_info($user_data);
         /******************************* USERS POSTS ***************************************/
         $you_may_know = get_may_know($user_data["id"], $db);
     } else {
         $user_data = $db->DBSelectOne("users", "id, name , email, sex, age, address, info", array("email" => $profile_email));
         if ($user_data != null) {
             $user_avatar = file_exists("images/ava/" . $user_data["id"] . ".png") ? $user_data["id"] : "unknown";
             $user_infos = '<img class="img-circle with_shadow with_border" src="images/ava/' . $user_avatar . '.png" height="200px" width="200px">
                             <h1>' . $user_data["name"] . '</h1>' . $user_data["info"];
             $more_infos = get_more_info($user_data);
             /******************************* USERS POSTS ***************************************/
             $order_by = array();
             $order_by[] = array("column" => "time", "sort" => "DESC");
             $all_posts_arr = $db->DBSelectAll("posts", "id, users_id, text, time", array("users_id" => $user_data["id"]), "", $order_by);
             $all_posts = get_all_posts($db, $all_posts_arr, $db);
             $you_may_know = get_may_know($user_data["id"], $db);
         } else {
             $user_avatar = "unknown";
             $user_infos = '<img class="img-circle with_shadow with_border" src="images/ava/' . $user_avatar . '.png" height="200px" width="200px">
                             <h1>Unknown</h1>
                                 ';
             $more_infos = "profile not found";
             $all_posts = "<div style='text-align:center;'><h2>Profile not found</h2></div>";
             $you_may_know = get_may_know($user_data["id"], $db);
         }
     }
     $copy_right = '<p>Copyright &copy; 2015 Vnkid</p>';
     return array("nav_links" => $nav_links, "user_infos" => $user_infos, "more_infos" => $more_infos, "you_may_know" => $you_may_know, "all_posts" => $all_posts, "copy_right" => $copy_right, "new_post" => $new_post_form);
 }
Example #13
0
$inFile = $_GET['file'];
if ($inFile == 'true') {
    header("Content-Disposition: attachment; filename=\"report.csv\";");
    header("Content-Transfer-Encoding: binary");
}
$contentType = $_GET['query'];
ob_end_clean();
switch ($contentType) {
    case "blogs":
        get_all_blogs();
        break;
    case "pages":
        get_all_pages();
        break;
    case "posts":
        get_all_posts();
        break;
    case "tags":
        get_all_tags();
        break;
    case "users":
        get_all_users();
        break;
    case "administrators":
        get_all_users("administrator");
        break;
    case "authors":
        get_all_users("author");
        break;
    case "contributors":
        get_all_users("contributor");
Example #14
0
function admin_action()
{
    $posts = get_all_posts();
    $html = render_template("View/Templates/admin.php", array('posts' => $posts));
    return $html;
}
Example #15
0
function get_posts_for_category($category)
{
    $category = trim(strtolower($category));
    return get_all_posts(array("category" => $category));
}
Example #16
0
 function about_action()
 {
     $posts = get_all_posts();
     require "view/template/post/bout.php";
 }
Example #17
0
/**
* массив$posts содержит выборку всех полей из
*таблицы post.
*Погружает файл list.php,содержащий вид вывода.
*информации из$posts в браузере.
*/
function list_action()
{
    echo 'test2';
    $posts = get_all_posts();
    require "View/Templates/list.php";
}
Example #18
0
    $categories = get_categories();
    foreach ($categories as $category) {
        if ($category->parent > 0) {
            $data[get_cat_name($category->parent)] = $category->parent;
        }
    }
    return $data;
}
if (function_exists(vc_map)) {
    vc_map(array("name" => __("Post/Page Display"), "base" => "post_display", "category" => __('Graham'), "params" => array(array("type" => "dropdown", "holder" => "div", "class" => "", "heading" => __("Post and Pages"), "param_name" => "post", "value" => get_all_post_or_pages(), "description" => __("Display one post or page on block")))));
    vc_map(array("name" => __("Video Display"), "base" => "video_display", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Text"), "param_name" => "text", "value" => '', "description" => __("Text to display on image")), array("type" => "attach_image", "holder" => "div", "class" => "", "heading" => __("Image"), "param_name" => "image", "value" => '', "description" => __("Image url")), array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Video Url"), "param_name" => "video", "value" => '', "description" => __("Video url")))));
    vc_map(array("name" => __("Slider categories"), "base" => "slider_categories", "category" => __('Graham'), "params" => array(array("type" => "checkbox", "holder" => "div", "class" => "", "heading" => __("Categories"), "param_name" => "post", "value" => get_all_categories(), "description" => __("Display main post with a post slider below, add class 'result_slider_categories' to rows you what to hide when activate slider")))));
    vc_map(array("name" => __("Filter children categories"), "base" => "filter_categories", "category" => __('Graham'), "params" => array(array("type" => "dropdown", "holder" => "div", "class" => "", "heading" => __("Post"), "param_name" => "post", "value" => get_all_categories_parents(), "description" => __("Display all children categories by parent and posts")))));
    vc_map(array("name" => __("Sidebar post"), "base" => "sidebar_post", "category" => __('Graham'), "params" => array(array("type" => "dropdown", "holder" => "div", "class" => "", "heading" => __("Post"), "param_name" => "post", "value" => get_all_posts(), "description" => __("Display post on sidebar template")))));
    vc_map(array("name" => __("Sidebar post with Location"), "base" => "sidebar_post_location", "category" => __('Graham'), "params" => array(array("type" => "dropdown", "holder" => "div", "class" => "", "heading" => __("Post"), "param_name" => "post", "value" => get_all_posts(), "description" => __("Display post on sidebar template")))));
    vc_map(array("name" => __("Leaderships"), "base" => "leaderships", "category" => __('Graham'), "params" => array(array("type" => "dropdown", "holder" => "div", "class" => "", "heading" => __("Leadership"), "param_name" => "post", "value" => get_all_posts(array('orderby' => 'name', 'order' => 'ASC', 'post_status' => 'publish', 'post_type' => 'leadership')), "description" => __("Display post on sidebar template")))));
    vc_map(array("name" => __("Video Display without Text"), "base" => "video_display_no_text", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Video url"), "param_name" => "video", "value" => '', "description" => __("Video url")), array("type" => "attach_image", "holder" => "div", "class" => "", "heading" => __("Image"), "param_name" => "image", "value" => '', "description" => __("Image url")))));
    vc_map(array("name" => __("Custom Title"), "base" => "custom_title", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Custom Header"), "param_name" => "title", "value" => ''))));
    vc_map(array("name" => __("Slider Images"), "base" => "slider_images", "category" => __('Graham'), "params" => array(array("type" => "attach_images", "holder" => "div", "class" => "", "heading" => __("Images"), "param_name" => "post", "value" => ''))));
    $idObj = get_category_by_slug('offices');
    $id_categ = $idObj->term_id;
    vc_map(array("name" => __("Single Location Filter"), "base" => "single_location_filter", "category" => __('Graham'), "params" => array(array("type" => "dropdown", "holder" => "div", "class" => "", "heading" => __("Filter Location"), "param_name" => "category_id", "value" => get_all_categories(array('type' => 'post', 'child_of' => $id_categ))), array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Filter name"), "param_name" => "filter_name", "value" => ''))));
    vc_map(array("name" => __("Video Sidebar"), "base" => "video_sidebar_post", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Title"), "param_name" => "title", "value" => ''), array("type" => "textarea", "holder" => "div", "class" => "", "heading" => __("Description"), "param_name" => "description", "value" => ''), array("type" => "attach_image", "holder" => "div", "class" => "", "heading" => __("Image"), "param_name" => "image", "value" => '', "description" => __("Image url")), array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Video Url"), "param_name" => "video", "value" => '', "description" => __("Video url")))));
    vc_map(array("name" => __("Block with Link"), "base" => "block_with_link", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Title"), "param_name" => "title", "value" => '', "description" => __("Text content for block")), array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("URL"), "param_name" => "url", "value" => ''))));
    vc_map(array("name" => __("Job Listing"), "base" => "job_listing", "category" => __('Graham')));
    vc_map(array("name" => __("Image with header"), "base" => "image_with_header", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Header"), "param_name" => "title", "value" => ''), array("type" => "attach_image", "holder" => "div", "class" => "", "heading" => __("Image"), "param_name" => "image", "value" => ''))));
    vc_map(array("name" => __("Video with header"), "base" => "video_with_header", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Header"), "param_name" => "title", "value" => ''), array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Video url"), "param_name" => "video", "value" => ''), array("type" => "attach_image", "holder" => "div", "class" => "", "heading" => __("Image"), "param_name" => "image", "value" => ''))));
    vc_map(array("name" => __("Testimonials"), "base" => "testimonials", "category" => __('Graham'), "params" => array(array("type" => "textfield", "holder" => "div", "class" => "", "heading" => __("Header"), "param_name" => "title", "value" => ''))));
}
add_shortcode('testimonials', 'graham_testimonials');
function graham_testimonials($arg)