コード例 #1
0
ファイル: mc_helper.php プロジェクト: urangawak/minangcms
 function mc_allpost($param = array(), $order = 'post_date DESC', $group = '', $limit = '')
 {
     $CI =& get_instance();
     $CI->load->helper('posts_helper');
     $data = getPosts($param, $order, $group, $limit);
     return $data;
 }
コード例 #2
0
ファイル: blogApi.php プロジェクト: lmdoom/Omsu-Web-course
function getBlogPost($id)
{
    include 'storage.php';
    $posts = getPosts();
    $output = '<h2>' . $posts[$id]['title'] . '</h2>' . $posts[$id]['body'];
    return $output;
}
コード例 #3
0
ファイル: blog.php プロジェクト: lmdoom/Omsu-Web-course
function getBlogPostsList()
{
    $posts = getPosts();
    $output = '';
    foreach ($posts as $post) {
        $title = $post['title'];
        $body = $post['body'];
        $output .= "<li><h3>{$title}</h3>{$body}</li>";
    }
    return $output;
}
コード例 #4
0
ファイル: home.php プロジェクト: lmdoom/Omsu-Web-course
function getBlogPostsList()
{
    $posts = getPosts();
    $output = '';
    foreach ($posts as $key => $post) {
        $title = $post['title'];
        $body = $post['body'];
        $href = "/blog/blog.php?post_id={$key}";
        $output .= "<li><h3><a href='{$href}'>{$title}</a></h3>{$body}</li>";
    }
    return $output;
}
コード例 #5
0
 function GetPosts()
 {
     $messageFileCount = 0;
     $rows = getPosts($this->SystemId);
     $posts = array();
     foreach ($rows as $row) {
         array_push($posts, new Post($row));
         if (++$messageFileCount >= DATA_ITEM_LOADS && $posts[count($posts) - 1]->Receiver == $posts[count($posts) - 1]->ReceiverOriginal) {
             break;
         }
     }
     return $posts;
 }
コード例 #6
0
 function GetPosts()
 {
     $messageFileCount = 0;
     $rows = getPosts($this->SystemId);
     $posts = array();
     foreach ($rows as $row) {
         array_push($posts, new Post($row));
         if (++$messageFileCount >= DATA_ITEM_LOADS) {
             break;
         }
     }
     return $posts;
 }
コード例 #7
0
function confirmDelete($db, $url)
{
    $p = getPosts($db, '', $url);
    return <<<FORM
  <form action="/post-hub-php/admin.php" method="post">
    <fieldset>
      <legend>Are You Sure?</legend>
      <p>Are you sure you want to delete the post "{$p['title']}"?</p>
      <input type="submit" name="submit" value="Yes" class="btn btn-default" />
      <input type="submit" name="submit" value="No" class="btn btn-default" />
      <input type="hidden" name="action" value="delete" />
      <input type="hidden" name="url" value="{$url}" />
    </fieldset>
  </form>
FORM;
}
コード例 #8
0
ファイル: profile.php プロジェクト: expl0iit/quatro
    echo "display:none;";
}
?>
">
                            <?php 
echo $settings;
?>
                        </div><!--
                    --></div>
                </div><!--
            --></div><!--
                -->
            <div class="posts">
                <div id="posts-box">
                    <?php 
echo getPosts($link, "SELECT * FROM `posts` WHERE `author`='" . $profile['username'] . "' AND `group`='0' AND `comment`='0' ORDER BY `id` DESC LIMIT 20", false, $user['username']);
?>
                </div>
                <div id="info-box" style="display:none;">
                    <h3><?php 
echo $subscriptions;
?>
</h3>
                    <?php 
$friends = explode(",", $profile['friends']);
foreach ($friends as $friend) {
    if ($friend != "" && $friend != null) {
        echo "<a href=\"u-{$friend}\"><img class=\"avatar\" src=\"" . getUserInfo($link, $friend)['avatar'] . "\" alt=\"{$friend}\" title=\"{$friend}\" /></a>";
    }
}
?>
コード例 #9
0
ファイル: index.php プロジェクト: tcitworld/FaceClone
if (isset($_GET['logout']) || empty($_SESSION['login'])) {
    $_SESSION = array();
    session_destroy();
    unset($_SESSION);
    $user = NULL;
    $callLogin = true;
}
/*
	Posting a new message.
*/
if (isset($_POST['msg']) && Tools::isLogged()) {
    $attachment = new Attachment(Tools::getURL($_POST['msg']));
    // Trying to get information about an eventual url in text
    $database->newMessage($user->getid(), $_POST['msg'], $attachment->getUrl());
    // saving new message
    $posts2 = getPosts($database, $user, $offset, $itemsPerPage);
    // getting his posts
    $posts = $posts2[0];
    $numArticles = $posts2[1];
}
/*
	Rendering the template with its variables
*/
if ($callLogin) {
    Tools::callTwig('login.twig', array());
} else {
    if (Tools::isLogged()) {
        Tools::callTwig('index.twig', array('connected' => Tools::isLogged(), 'user' => $user, 'posts' => $posts, 'newsession' => $newsession, 'page' => $page, 'pagecount' => (int) ceil($numArticles / $itemsPerPage)));
    }
}
/*
コード例 #10
0
                } else {
                    if ($decoded->function == 'removePost') {
                        removePost($decoded->post_id);
                    } else {
                        if ($decoded->function == 'removeTema') {
                            removeTema($decoded->tema_id);
                        }
                    }
                }
            }
        }
    }
} else {
    $function = $_GET["function"];
    if ($function == 'getPosts') {
        getPosts();
    } elseif ($function == 'getTemas') {
        getTemas($_GET["todos"]);
    }
}
/////// INSERT ////////
/**
 * @description Crea un post, su relación con uno o varios temas y sus fotos
 * @param $post
 */
function createPost($post)
{
    validateRol(1);
    $db = new MysqliDb();
    $db->startTransaction();
    $item_decoded = checkPosts(json_decode($post));
コード例 #11
0
            </div>
        </div>
    </div>
    <?php 
    }
    ?>
  <div class="section-a">
      <div class="grid">
          <div class="row">
              <div class="col-wd-12">
                  <div class="col">
                    <div id="postsbody">
                      <h1>Posts</h1>
                      <?php 
    // Call to a function that retrieves the user posts
    $results = getPosts($_GET['id']);
    foreach ($results as $attrs) {
        echo "<p class='dateadded'> Date & Time Of Post: " . $attrs["P_Date"] . "</p>";
        echo "<p class='content'>" . $attrs["P_Body"] . "</p>";
        echo "<a id='" . $attrs["P_ID"] . "'>Like Post</a>";
        echo "<hr>";
    }
    ?>
                    </div>
                  </div>
              </div>
          </div>
      </div>
  </div>

  <?php 
コード例 #12
0
ファイル: comments.php プロジェクト: expl0iit/quatro
<?php

include '../incl/creds.php';
include '../incl/functions.php';
$link = mysqli_connect($sql_host, $sql_user, $sql_pass, $sql_db);
$post = mysqli_escape_string($link, $_POST['post']);
?>
    <form action="post.php" method="POST">
        <textarea name="post" id="postHere" style="border: 2px dashed #000000;"></textarea><br>
        <input type="text" name="touser" value="" style="display:none;"/>
        <input type="text" name="group" value="<?php 
echo $tmp_group;
?>
" style="display:none;"/>
        <input type="text" name="response" value="<?php 
echo $post;
?>
" style="display:none;"/>
        <input type="submit" id="submitHere" value="-&gt;" style="font-weight:bold;background-color:transparent;border:1px solid #000000;"/>
    </form>
<?php 
echo getPosts($link, "SELECT * FROM `posts` WHERE `comment`='{$post}' ORDER BY id ASC", true, $_POST['user']);
コード例 #13
0
		  <label>
		    <input type="radio" name="frontpagepage" id="showpages" <?php 
echo $fpPage;
?>
>
		    Halaman
		  </label>
		</div>
		<div id="pagescombo" <?php 
echo $pageDisplay;
?>
>
			<select name="pagefont" class="form-control">
				<?php 
$sPost = array('post_type' => 'page', 'post_status' => 'publish');
$post = getPosts($sPost, 'post_title ASC');
if ($post['jumlah'] > 0) {
    foreach ($post['data'] as $rPost) {
        ?>
						<option value="<?php 
        echo $rPost->post_id;
        ?>
"><?php 
        echo $rPost->post_title;
        ?>
</option>
						<?php 
    }
}
?>
			</select>
コード例 #14
0
ファイル: fb-callback.php プロジェクト: sdsunjay/rideshare
var_dump($accessToken->getValue());
// The OAuth 2.0 client handler helps us manage access tokens
$oAuth2Client = $fb->getOAuth2Client();
// Get the access token metadata from /debug_token
$tokenMetadata = $oAuth2Client->debugToken($accessToken);
echo '<h3>Metadata</h3>';
var_dump($tokenMetadata);
// Validation (these will throw FacebookSDKException's when they fail)
$tokenMetadata->validateAppId(APP_ID);
// If you know the user ID this access token belongs to, you can validate it here
//$tokenMetadata->validateUserId('123');
$tokenMetadata->validateExpiration();
if (!$accessToken->isLongLived()) {
    // Exchanges a short-lived access token for a long-lived one
    try {
        $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
    } catch (Facebook\Exceptions\FacebookSDKException $e) {
        echo "<p>Error getting long-lived access token: " . $helper->getMessage() . "</p>\n\n";
        exit;
    }
    echo '<h3>Long-lived</h3>';
    var_dump($accessToken->getValue());
}
// Logged in!
$_SESSION['fb_access_token'] = (string) $accessToken;
// Sets the default fallback access token so we don't have to pass it to each request
$fb->setDefaultAccessToken((string) $accessToken);
getPosts($fb);
// User is logged in with a long-lived access token.
// You can redirect them to a members-only page.
//header(REDIRECT_MEMBERS_URL);
コード例 #15
0
function displayFastEdit()
{
    if ($_REQUEST['action'] == 'update') {
        $posts = getPosts($_REQUEST['categories'], $_REQUEST['s'], $num);
        $ids = array();
        $content = trim(stripslashes($_REQUEST['content']));
        $content_stripped = strip_tags($_POST['content']);
        $updated = 0;
        foreach ($posts as $post) {
            $post_content = trim($post->post_content);
            if (!$_REQUEST['location']) {
                //at the start
                //check if it is existent
                $match = isMatchAtStart($post_content, $content, $newContent);
                if (!$match && $_POST['actionType'] == 'insert') {
                    $post_content = $content . '<br /><br />' . $post_content;
                    $updated++;
                } else {
                    if ($match && $_REQUEST['actionType'] == 'delete') {
                        $post_content = preg_replace('/<br *?\\/?><br *\\/?>(<\\/body><\\/html>)?$/i', '$1', $newContent);
                        $updated++;
                    } else {
                        $skipped++;
                    }
                }
            } else {
                //at the end
                //check if it is existent
                $match = isMatch($post_content, $content, $newContent);
                if (!$match && $_POST['actionType'] == 'insert') {
                    $post_content = $post_content . '<br /><br />' . $content;
                    $updated++;
                } else {
                    if ($match && $_REQUEST['actionType'] == 'delete') {
                        $post_content = preg_replace('/<br *?\\/?><br *\\/?>(<\\/body><\\/html>)?$/i', '$1', $newContent);
                        $updated++;
                    } else {
                        $skipped++;
                    }
                }
            }
            wp_update_post(array('ID' => $post->ID, 'post_content' => $post_content));
        }
        if ($_POST['actionType'] == 'insert') {
            $message = 'Updated ' . $updated . ' posts';
            if ($skipped > 0) {
                $message .= ' and skipped ' . $skipped . ' posts because they have the text already';
            }
        } else {
            $message = 'Updated ' . $updated . ' posts';
            if ($skipped > 0) {
                $message .= ' and skipped ' . $skipped . ' posts because they do not have the text';
            }
        }
        $messages[] = $message . '.';
    }
    ?>
<style>

#poststuff .inside {
    margin: 0;
    padding: 0;
}
</style>
<script>
	jQuery(document).ready(function() {
		jQuery('#post-search-keyword, #categories').change(function() {
			jQuery.ajax({
				url:ajaxurl,
				data:{
					action:'getResultNumber',
					keyword:jQuery('#post-search-keyword').val(),
					category:jQuery('#categories').val(),
				},
				success: function(data) {
					jQuery('#postsCountBox').text('Matches: '+data+' posts');
				}
			});
		});
	});
</script>
<div class="wrap">
<form id="posts-filter" action="" method="post">
<input type="hidden" name="action" value="update" />
<h2><?php 
    echo __('Fast Edit Plugin');
    ?>
</h2>
<?php 
    if (!empty($messages)) {
        echo '<div id="message" class="updated"><p>' . join(' ', $messages) . '</p></div>';
    }
    unset($messages);
    ?>
<div id="poststuff">
<div id="post-body" class="columns-2">


<?php 
    $args = array('show_option_all' => 'All Categories', 'show_option_none' => '', 'orderby' => 'ID', 'order' => 'ASC', 'show_count' => 0, 'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 'selected' => $_POST['category'], 'hierarchical' => 1, 'name' => 'categories', 'id' => 'categories', 'class' => 'postform', 'depth' => 0, 'tab_index' => 0, 'taxonomy' => 'category', 'hide_if_empty' => false, 'walker' => '');
    ?>
<input type="hidden" name="post_type" class="post_type_page" value="<?php 
    echo $post_type;
    ?>
" />

<div id="post-body-content">
<?php 
    the_editor(stripslashes($_POST['content']), $id = 'content', $prev_id = 'title', $media_buttons = false, $tab_index = 2);
    ?>
</div>
<div class="postbox" id="postbox-container-1">
<h3 class="hndle"><span>Search Criteria / Action</span></h3>

<div class="inside">
<div style="border-bottom: 1px solid #DDDDDD;border-top: 1px solid #FFFFFF;padding: 10px 12px 0;">
<p><b>Filter by Cartegory:</b></p>
<?php 
    wp_dropdown_categories($args);
    ?>
 

 <p><b>
	Filter By Keyword:
</b></p>
 <p>	<input type="search" value="" name="s" id="post-search-keyword">
</p>
</div>
<div style="border-bottom: 1px solid #DDDDDD;border-top: 1px solid #FFFFFF;padding: 10px 12px 0;">

 <p><b>
	What to do?
</b></p>
 <p>
	<input type="radio" value="insert" name="actionType"<?php 
    if ($_POST['actionType'] != 'delete') {
        echo ' checked="checked"';
    }
    ?>
> Insert Text<br />
	<input type="radio" value="delete" name="actionType"<?php 
    if ($_POST['actionType'] == 'delete') {
        echo ' checked="checked"';
    }
    ?>
> Delete Text <br />
</p>
</div>
<div style="border-bottom: 1px solid #DDDDDD;border-top: 1px solid #FFFFFF;padding: 10px 12px 0;">

 <p><b>
	Insertion Location
</b></p>
 <p>
	<input type="radio" value="0" name="location"<?php 
    if (isset($_POST['location']) && $_POST['location'] != '1') {
        echo ' checked="checked"';
    }
    ?>
> At the start<br />
	<input type="radio" value="1" name="location"<?php 
    if (!isset($_POST['location']) || $_POST['location'] == '1') {
        echo ' checked="checked"';
    }
    ?>
> At the end<br />
</p></div>
<div style="float:left;padding: 1em 10px;" id="postsCountBox"></div>
<p style="border-top: 1px solid #FFFFFF;margin: 0;padding: 1em 10px;text-align: right;">

<input type="submit" value="Update" class="button button-primary button-large" id="updatePosts" name="">
</p>
</div>


</div>
</div>
</form>

</div>
<?php 
}
コード例 #16
0
ファイル: pagecore.php プロジェクト: vluo/myPoto
 function getPosts()
 {
     return getPosts();
 }
コード例 #17
0
ファイル: grid-buddy.php プロジェクト: glebpro/Grid-Buddies
function grid_buddy_shortcode($atts)
{
    $a = shortcode_atts(array('id' => '1'), $atts, 'grid-buddy');
    $posts = getPosts(intval($atts['id']));
    outputGridOptions(intval($atts['id']));
    if ($posts != NULL) {
        buildBoxes($posts, intval($atts['id']));
    } else {
        echo "There's no posts!";
    }
}
コード例 #18
0
/**
 * This script manages the display of forum threads in flat view
 * @copyright Julio Montoya <*****@*****.**> UI Improvements + lots of bugfixes
 * @package chamilo.forum
 */
// Delete attachment file
if (isset($_GET['action']) && $_GET['action'] == 'delete_attach' && isset($_GET['id_attach'])) {
    delete_attachment(0, $_GET['id_attach']);
}
$sessionId = api_get_session_id();
$_user = api_get_user_info();
$userId = api_get_user_id();
$groupId = api_get_group_id();
$sortDirection = isset($_GET['posts_order']) && $_GET['posts_order'] === 'desc' ? 'DESC' : 'ASC';
if (isset($current_thread['thread_id'])) {
    $rows = getPosts($current_thread['thread_id'], $sortDirection);
    $increment = 0;
    $clean_forum_id = intval($_GET['forum']);
    $clean_thread_id = intval($_GET['thread']);
    $locked = api_resource_is_locked_by_gradebook($clean_thread_id, LINK_FORUM_THREAD);
    $closedPost = null;
    if (!empty($rows)) {
        foreach ($rows as $row) {
            if ($row['user_id'] == '0') {
                $name = prepare4display($row['poster_name']);
            } else {
                $name = api_get_person_name($row['firstname'], $row['lastname']);
            }
            $username = sprintf(get_lang('LoginX'), $row['username']);
            if ($current_forum_category && $current_forum_category['locked'] == 0 && $current_forum['locked'] == 0 && $current_thread['locked'] == 0 || api_is_allowed_to_edit(false, true)) {
                if ($_user['user_id'] || $current_forum['allow_anonymous'] == 1 && !$_user['user_id']) {
コード例 #19
0
ファイル: editfaq.php プロジェクト: aurelienshz/g1a
        // si on a posté le formulaire :
        if (!empty($_POST)) {
            require MODELES . 'backoffice/createPost.php';
            if ($postId = createPost($_POST['question'], $_POST['reponse'])) {
                $message = 'Nouvelle entrée créée avec succès !';
            } else {
                $message = 'Oups ! Une erreur s\'est produite...';
            }
            $post = ['id' => $postId, 'question' => $_POST['question'], 'reponse' => $_POST['reponse']];
        } else {
            $post = ['id' => 'new', 'question' => '', 'reponse' => ''];
        }
    } else {
        if (isset($_GET['id']) && ($post = getPosts($_GET['id']))) {
            // si on a posté le formulaire :
            if (!empty($_POST)) {
                require MODELES . 'backoffice/setPost.php';
                if (setPost($_GET['id'], $_POST['question'], $_POST['reponse'])) {
                    $message = 'La modification a été effectuée !';
                } else {
                    $message = 'Oups ! Une erreur s\'est produite...';
                }
            }
            $post = getPosts($_GET['id']);
        } else {
            echo 'Invalid parameter';
            exit;
        }
    }
    require VUES . 'backoffice/editfaq.php';
}
コード例 #20
0
ファイル: group.php プロジェクト: expl0iit/quatro
    echo "display:none;";
}
?>
">
                            <?php 
echo $settings;
?>
                        </div><!--
                    --></div>
                </div><!--
            --></div><!--
                -->
            <div class="posts">
                <div id="posts-box">
                    <?php 
echo getPosts($link, "SELECT * FROM `posts` WHERE `group`='" . $group['id'] . "' ORDER BY `id` DESC LIMIT 20", false, $user['username']);
?>
                </div>
                <div id="info-box" style="display:none;">
                    <?php 
echo $group_creator . ": <a href=\"u-" . $group['author'] . "\">" . $group['author'] . "</a>";
?>
                    <h3><?php 
echo $group_users;
?>
</h3>
                    <?php 
$friends = explode(",", $group['users']);
foreach ($friends as $friend) {
    if ($friend != "" && $friend != null) {
        echo "<a href=\"u-{$friend}\"><img class=\"avatar\" src=\"" . getUserInfo($link, $friend)['avatar'] . "\" alt=\"{$friend}\" title=\"{$friend}\" /></a>";
コード例 #21
0
ファイル: post.php プロジェクト: Satan1301/phpoopcms
    }
} else {
    ?>
<h1>
    <a href="<?php 
    echo HTTP_SERVER . 'index.php?post=1&task=new';
    ?>
">add new post</a>
</h1>
<h3>
</h3>
<p class="desc">
    Add a new post by clickin on above link.
</p>
<?php 
    $posts = getPosts();
    if (mysql_num_rows($posts)) {
        while ($row = mysql_fetch_assoc($posts)) {
            $post = new Post($row['post_link']);
            if ($post->post_delete) {
                $style = '';
            } else {
                $style = ' class="del"';
            }
            ?>
				<h1<?php 
            echo $style;
            ?>
>
                	<?php 
            echo html_entity_decode($post->post_h1);
コード例 #22
0
ファイル: blog.php プロジェクト: amdad/FisherEvans.com
$second_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
$third_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
$forth_resource = sizeof($uri) > 0 ? array_shift($uri) : "";
switch ($second_resource) {
    case "post":
        echo '<h2 class="page_title_withside">Only Showing One Post</h2>';
        printPost(getPost($third_resource));
        break;
    case "tag":
        echo '<h2 class="page_title_withside">Posts Tagged:</h2>';
        echo '<h1 class="page_title_withside">' . getTagName($third_resource) . '</h1>';
        foreach (getPostsByTag($third_resource) as $post) {
            printPost($post);
        }
        break;
    case "all":
        echo '<h1 class="page_title_withside">All Blog Posts</h1>';
        echo '<div class="page_content">';
        foreach (getPosts(0, getPostCount()) as $post) {
            printPostSummary($post);
        }
        echo '</div>';
        break;
    default:
        $page = $second_resource === "" ? 1 : $second_resource;
        foreach (getPosts(($page - 1) * $blogPageSize, $blogPageSize) as $post) {
            printPost($post);
        }
        printBlogPageLinks($page);
        break;
}
コード例 #23
0
ファイル: main.php プロジェクト: jaranvil/CraftNanny
// compose XML
if ($debugMode) {
    $debugInfo = $xmlDoc->createElement('debug_info');
    $xmlRoot->appendChild($debugInfo);
    $requestOptions = $xmlDoc->createElement('options');
    $debugInfo->appendChild($requestOptions);
    $textNode = $xmlDoc->createTextNode($_REQUEST['a']);
    $requestOptions->appendChild($textNode);
}
foreach ($actionArray as $action) {
    switch ($action) {
        case "setuprecord":
            $xmlRoot->appendChild(setUpRecord($dbconn, $ldapConfig, $xmlDoc, $_REQUEST['username']));
            break;
        case "getPosts":
            $xmlRoot->appendChild(getPosts($dbConn, $xmlDoc, $_REQUEST['page'], $_REQUEST['sub'], $_REQUEST['user'], $_REQUEST['comments']));
            break;
        case "email":
            phpMailer($xmlDoc, $_REQUEST['name'], $_REQUEST['email'], $_REQUEST['subject'], $_REQUEST['msg']);
            break;
        case "doesUserExist":
            $xmlRoot->appendChild(doesUserExist($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['user_type']));
            break;
        case "addGoogleUser":
            $xmlRoot->appendChild(addGoogleUser($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['name'], $_REQUEST['email'], $_REQUEST['url']));
            break;
        case "addPost":
            $xmlRoot->appendChild(addPost($dbconn, $xmlDoc, $_REQUEST['id'], $_REQUEST['title'], $_REQUEST['text'], $_REQUEST['url'], $_REQUEST['sub']));
            break;
        case "userInfo":
            $xmlRoot->appendChild(userInfo($dbconn, $xmlDoc, $_REQUEST['id']));
コード例 #24
0
$acte = 1;
$pageCounter = 1;
while ($wordCount < 50000) {
    $scene = 1;
    $changeForum = mt_rand() / mt_getrandmax() < 0.5;
    $forumUrl = $changeForum ? "/forums/0-50-0-1-0-" . $pageCounter . "-0-blabla-15-18-ans.htm" : "/forums/0-51-0-1-0-" . $pageCounter . "-0-blabla-18-25-ans.htm";
    $forumUrl = $baseUrl . $forumUrl;
    echo '<h2>Acte ' . $acte . '</h2>';
    while ($wordCount < 50000 && $scene < 6) {
        $topics = getTopics($forumUrl);
        if (count($topics) > 0) {
            $topic = $topics[array_rand($topics)];
            echo '<h3>Scène ' . $scene . ' : <a href="' . $topic->url . '">' . $topic->name . '</a></h3>';
            $wordCount += str_word_count($topic->name);
            echo '<div class="scene">';
            $posts = getPosts($topic->url);
            $posts = array_map("unserialize", array_unique(array_map("serialize", $posts)));
            echo '<div class="liste-personnages">';
            $users = array_map(function ($e) {
                return $e->user;
            }, $posts);
            $users = array_values(array_filter(array_unique($users)));
            foreach ($users as $key => $user) {
                if (!empty($user)) {
                    echo trim($user);
                }
                if ($key != count($users) - 1) {
                    echo ', ';
                }
            }
            echo '</div>';
コード例 #25
0
ファイル: rss.php プロジェクト: Harrmalik/post-hub-php
<?php

// Include necessary filesize
include_once '../inc/functions.inc.php';
include_once '../inc/db.inc.php';
// Open a database connection
$db = new PDO(DB_INFO, DB_USER, DB_PASS);
// Load all blog post
$p = getPosts($db, 'thread');
// Remove the fulldisp flag
array_pop($p);
// Perform basic data sanitization
$p = sanitizeData($p);
// Add a content type header to ensure proper execution
header('Content-Type: application/rss+xml');
// Output XML declaration
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>

<rss version="2.0">
  <channel>
    <title>Post Hub PHP</title>
    <link>http://localhost/post-hub-php/</link>
    <description>This blog is awesome.</description>
    <language>en-us</language>

    <?php 
// Loop through the posts and generate RSS items
foreach ($p as $p) {
    // Escape HTML to avoid errors
    $post = htmlentities($p['content']);
コード例 #26
0
ファイル: viewPost.php プロジェクト: expl0iit/quatro
    $user = getUserInfo($link, $_SESSION['login']);
    include getLangFile($user['lang']);
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>Quatro - Your feed</title>
        <script type="text/javascript" src="resx/js.js"></script>
        <link rel="stylesheet" href="resx/css.css">
        <link rel="stylesheet" href="resx/small_topbar.css">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
    </head>
    <body>
        <?php 
if ($user != null) {
    include 'incl/topbar.php';
}
?>
        <div class="content">
            <div class="post">
                <?php 
echo getPosts($link, "SELECT * FROM `posts` WHERE `id`='" . $postid . "'", false, $user['username']);
?>
            </div> 
        </div>
    </body>
</html>
<?php 
mysqli_close($link);
コード例 #27
0
ファイル: rss.php プロジェクト: amdad/FisherEvans.com
    <channel>
        <title>FisherEvans.com | Blog</title>
        <link>http://fisherevans.com/blog</link>
        <generator>http://fisherevans.com/blog</generator>
        <description>This feed displays the most recent blog posts made by Fisher to his blog.</description>
        <lastBuildDate><?php 
echo $datePosted;
?>
</lastBuildDate>
        <pubDate><?php 
echo $datePosted;
?>
</pubDate>
        <language>en-US</language>
        <atom:link href="http://fisherevans.com/rss/" rel="self" type="application/rss+xml" />
        <image>
            <title>FisherEvans.com | Blog</title>
            <url>http://fisherevans.com/favicon.gif</url>
            <link>http://fisherevans.com/</link>
            <description>Fisher's Blog</description>
            <width>16</width>
            <height>16</height>
        </image>
<?php 
foreach (getPosts(0, 20) as $post) {
    printPostRSS($post);
}
?>

    </channel>
</rss>
コード例 #28
0
/**
 * This function stores the edit of a post in the forum_post table.
 *
 * @param array
 * @return void HTML
 *
 * @author Patrick Cool <*****@*****.**>, Ghent University
 * @version february 2006, dokeos 1.8
 */
function store_edit_post($values)
{
    $threadTable = Database::get_course_table(TABLE_FORUM_THREAD);
    $table_posts = Database::get_course_table(TABLE_FORUM_POST);
    $course_id = api_get_course_int_id();
    //check if this post is the first of the thread
    // First we check if the change affects the thread and if so we commit
    // the changes (sticky and post_title=thread_title are relevant).
    $posts = getPosts($values['thread_id']);
    $first_post = null;
    if (!empty($posts) && count($posts) > 0 && isset($posts[0])) {
        $first_post = $posts[0];
    }
    if (!empty($first_post) && $first_post['post_id'] == $values['post_id']) {
        $params = ['thread_title' => $values['post_title'], 'thread_sticky' => isset($values['thread_sticky']) ? $values['thread_sticky'] : null, 'thread_title_qualify' => $values['calification_notebook_title'], 'thread_qualify_max' => $values['numeric_calification'], 'thread_weight' => $values['weight_calification'], 'thread_peer_qualify' => $values['thread_peer_qualify']];
        $where = ['c_id = ? AND thread_id = ?' => [$course_id, $values['thread_id']]];
        Database::update($threadTable, $params, $where);
    }
    // Update the post_title and the post_text.
    $params = ['post_title' => $values['post_title'], 'post_text' => $values['post_text'], 'post_notification' => isset($values['post_notification']) ? $values['post_notification'] : ''];
    $where = ['c_id = ? AND post_id = ?' => [$course_id, $values['post_id']]];
    Database::update($table_posts, $params, $where);
    // Update attached files
    if (!empty($_POST['file_ids']) && is_array($_POST['file_ids'])) {
        foreach ($_POST['file_ids'] as $key => $id) {
            editAttachedFile(array('comment' => $_POST['file_comments'][$key], 'post_id' => $values['post_id']), $id);
        }
    }
    if (!empty($values['remove_attach'])) {
        delete_attachment($values['post_id']);
    }
    if (empty($values['id_attach'])) {
        add_forum_attachment_file(isset($values['file_comment']) ? $values['file_comment'] : null, $values['post_id']);
    } else {
        edit_forum_attachment_file(isset($values['file_comment']) ? $values['file_comment'] : null, $values['post_id'], $values['id_attach']);
    }
    if (api_is_course_admin() == true) {
        $ccode = api_get_course_id();
        $sid = api_get_session_id();
        $link_info = GradebookUtils::is_resource_in_course_gradebook($ccode, 5, $values['thread_id'], $sid);
        $link_id = $link_info['id'];
        $thread_qualify_gradebook = isset($values['thread_qualify_gradebook']) ? $values['thread_qualify_gradebook'] : null;
        if ($thread_qualify_gradebook != 1) {
            if ($link_info !== false) {
                GradebookUtils::remove_resource_from_course_gradebook($link_id);
            }
        } else {
            if ($link_info === false && !$_GET['thread']) {
                $weigthqualify = $values['weight_calification'];
                GradebookUtils::add_resource_to_course_gradebook($values['category_id'], $ccode, 5, $values['thread_id'], Database::escape_string(stripslashes($values['calification_notebook_title'])), $weigthqualify, $values['numeric_calification'], null, 0, $sid);
            }
        }
    }
    // Storing the attachments if any.
    //update_added_resources('forum_post', $values['post_id']);
    $message = get_lang('EditPostStored') . '<br />';
    $message .= get_lang('ReturnTo') . ' <a href="viewforum.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&">
            ' . get_lang('Forum') . '</a><br />';
    $message .= get_lang('ReturnTo') . ' <a href="viewthread.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . $values['thread_id'] . '&post=' . intval($_GET['post']) . '">' . get_lang('Message') . '</a>';
    Session::erase('formelements');
    Session::erase('origin');
    Session::erase('breadcrumbs');
    Session::erase('addedresource');
    Session::erase('addedresourceid');
    Display::display_confirmation_message($message, false);
}
コード例 #29
0
ファイル: all_posts.php プロジェクト: Michaeldgeek/NacossUnn
        $success = false;
        $error_message = $exc->getMessage();
    }
    $posts = searchPosts($searchQuery, $sort_type, $order);
} else {
    //Process GET requests or no requests
    $page = filter_input(INPUT_GET, "pg");
    if (isset($page)) {
        //if switching page, repeat search
        $searchQuery = filter_input(INPUT_GET, "q");
        $sort_type = filter_input(INPUT_GET, "s");
        $order = filter_input(INPUT_GET, "o");
        $posts = searchPosts($searchQuery, $sort_type, $order);
    } else {
        $page = 1;
        $posts = getPosts($sort_type, $order);
    }
}
?>

<!--
Copyright 2015 NACOSS UNN Developers Group (NDG).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
コード例 #30
0
ファイル: index.php プロジェクト: hardkap/pritlog
function listPosts()
{
    global $separator, $entries, $config, $requestCategory, $priv;
    global $userFileName, $optionValue3, $lang, $theme_main, $SHP, $theme_post;
    $config_Teaser = 0;
    $filterEntries = array();
    $totalEntries = 0;
    //echo $priv."<br/>";
    if (trim($requestCategory) == "") {
        //$result = sqlite_query($config['db'], "select count(postid) AS view from posts WHERE type = 'post' or (type = 'page' AND stick = 'yes');");
        $result = sqlite_query($config['db'], "select count(postid) AS view from posts WHERE " . $priv . " (type = 'post' or (type = 'page' AND stick = 'yes'));");
        while ($row = @sqlite_fetch_array($result, SQLITE_ASSOC)) {
            $totalEntries = $row['view'];
            if ($row['view'] == 0) {
                $theme_main['content'] = '<br><br>' . $lang['msgNoPosts'] . ' <a href="' . $config['blogPath'] . $config['cleanIndex'] . '/newEntry">' . $lang['msgNoPostsMakeOne'] . '</a>?<br>';
            }
        }
    } else {
        //$result = sqlite_query($config['db'], "select count(postid) AS view from posts WHERE type = 'post' AND category = '$requestCategory';");
        //$result = sqlite_query($config['db'], "select count(postid) AS view from posts WHERE type = 'post' AND (category = '$requestCategory' or category like '$requestCategory,%'or category like '%,$requestCategory' or category like '%,$requestCategory,%');");
        $result = sqlite_query($config['db'], "select count(postid) AS view from posts WHERE " . $priv . " type = 'post' AND (category = '{$requestCategory}' or category like '{$requestCategory},%'or category like '%,{$requestCategory}' or category like '%,{$requestCategory},%');");
        while ($row = @sqlite_fetch_array($result, SQLITE_ASSOC)) {
            $totalEntries = $row['view'];
        }
    }
    if ($totalEntries == 0) {
        $theme_main['content'] = '<br><br>' . $lang['msgNoPosts'] . ' <a href="' . $config['blogPath'] . $config['cleanIndex'] . '/newEntry">' . $lang['msgNoPostsMakeOne'] . '</a>?<br>';
    }
    # Pagination - This is the so called Pagination
    $page = $optionValue3;
    if ($page == '') {
        $page = 1;
    }
    # What part of the array should i show in the page?
    $arrayEnd = $config['entriesPerPage'] * $page;
    $arrayStart = $arrayEnd - ($config['entriesPerPage'] - 1);
    # As arrays start from 0, i will lower 1 to these values
    $arrayEnd--;
    $arrayStart--;
    $totalEntries--;
    $i = $arrayStart;
    if ($arrayEnd > $totalEntries) {
        $arrayEnd = $totalEntries;
    }
    //echo 'a '.$i.' '.$arrayStart.' '.$arrayEnd.'<br>';
    $filterEntries = getPosts($arrayStart, $config['entriesPerPage'], $requestCategory);
    $j = 0;
    while ($i <= $arrayEnd) {
        $entry = explode($separator, $filterEntries[$j++]);
        $title = $entry[0];
        $titleModified = titleModify($title);
        $date1 = date("d M Y H:i", strtotime($entry[2]));
        $postMonth = date("M", strtotime($entry[2]));
        $postDay = date("d", strtotime($entry[2]));
        $postYear = date("Y", strtotime($entry[2]));
        $fileName = $entry[3];
        $category = html_entity_decode($entry[4]);
        $postType = $entry[5];
        $visits = $entry[7];
        $author = trim($entry[8]) == "" ? 'admin' : $entry[8];
        if (trim($visits) == "") {
            $visits = 0;
        }
        if (strstr($entry[1], "*readmore*")) {
            $readmore = '<br><br><a href="' . $config['blogPath'] . $config['cleanIndex'] . '/posts/' . $fileName . "/" . $titleModified . '">' . $lang['pageViewFullPost'] . ' &raquo;</a>';
        } else {
            $readmore = "";
        }
        $content = explode("*readmore*", $entry[1]);
        $theme_post['loc_top'] = "";
        $theme_post['loc_title_after'] = "";
        $theme_post['loc_content_after'] = "";
        $theme_post['loc_footer'] = "";
        $theme_post['loc_bottom'] = "";
        $theme_post['postLink'] = $config['blogPath'] . $config['cleanIndex'] . "/posts/" . $fileName . "/" . $titleModified;
        $theme_post['title'] = $title;
        $theme_post['content'] = html_entity_decode($content[0] . $readmore);
        $categoryText = str_replace("_", " ", $category);
        $theme_post['authorLabel'] = $lang['pageAuthorsNew1'];
        $theme_post['author'] = $author;
        $theme_post['dateLabel'] = $lang['postFtPosted'];
        $theme_post['date'] = $date1;
        $theme_post['postMonth'] = $postMonth;
        $theme_post['postDay'] = $postDay;
        $theme_post['postYear'] = $postYear;
        //$theme_post['categoryLabel'] = $lang['postFtCategory'];
        $theme_post['categoryLabel'] = $lang['postFtTags'];
        $theme_post['category'] = "";
        unset($listcats);
        foreach (explode(",", $category) as $singlecat) {
            $listcats[$singlecat] = "1";
        }
        $catsep = "";
        foreach ($listcats as $catkey => $catvalue) {
            $categoryText = str_replace("_", " ", $catkey);
            $theme_post['category'] .= $catsep . "<a href=" . $config['blogPath'] . $config['cleanIndex'] . "/category/" . $catkey . ">" . $categoryText . "</a>";
            $catsep = ",";
        }
        //$theme_post['category']      = "<a href=".$_SERVER['SCRIPT_NAME']."/viewCategory/".urlencode($category).">".$categoryText."</a>";
        $theme_post['visitsLabel'] = $lang['postFtVisits'];
        $theme_post['visits'] = $visits;
        if ($SHP->hooks_exist('hook-post')) {
            $SHP->execute_hooks('hook-post');
        }
        $commentFile = $config['commentDir'] . $fileName . $config['dbFilesExtension'];
        $result = sqlite_query($config['db'], "select count(*) AS view from comments WHERE postid='{$fileName}' AND status='approved';");
        $commentCount = sqlite_fetch_array($result);
        if ($commentCount['view'] > 0) {
            $commentText = $lang['postFtComments'] . ": " . $commentCount['view'];
        } else {
            $commentText = $lang['postFtNoComments'];
        }
        $theme_post['comments'] = "<a href=" . $config['blogPath'] . $config['cleanIndex'] . "/posts/" . $fileName . "/" . $titleModified . "#Comments>" . $commentText . "</a>";
        $theme_post['edit'] = $theme_post['delete'] = "";
        if (isset($_SESSION['logged_in']) ? $_SESSION['logged_in'] : false) {
            $theme_post['edit'] = "<a href=" . $config['blogPath'] . $config['cleanIndex'] . "/editEntry/" . $fileName . ">" . $lang['postFtEdit'] . "</a>";
            $theme_post['delete'] = "&nbsp;-&nbsp;<a href=" . $config['blogPath'] . $config['cleanIndex'] . "/deleteEntry/" . $fileName . ">" . $lang['postFtDelete'] . "</a></center><br/>";
        }
        if ($postType == "page") {
            $theme_main['content'] .= @preg_replace("/\\{([^\\{]{1,100}?)\\}/e", "\$" . "theme_post[" . "\$1" . "]", file_get_contents(getcwd() . "/themes/" . $config['theme'] . "/blocks/page.tpl"));
        } else {
            $theme_main['content'] .= @preg_replace("/\\{([^\\{]{1,100}?)\\}/e", "\$" . "theme_post[" . "\$1" . "]", file_get_contents(getcwd() . "/themes/" . $config['theme'] . "/blocks/post.tpl"));
        }
        $i++;
    }
    $totalEntries++;
    $totalPages = ceil($totalEntries / $config['entriesPerPage']);
    if ($totalPages >= 1) {
        $theme_main['content'] .= '<center> ' . $lang['msgPages'] . ': ';
    } else {
        //echo '<center> No more posts under this category.';
    }
    $startPage = $page == 1 ? 1 : $page - 1;
    $displayed = 0;
    for ($i = $startPage; $i <= $page - 1 + $config['maxPagesDisplayed']; $i++) {
        if ($i <= $totalPages) {
            if ($page != $i) {
                if (trim($requestCategory) == "") {
                    $categoryText = '/mainPage/allCategories';
                } else {
                    $categoryText = '/category/' . urlencode($requestCategory);
                }
                if ($i == $page - 1 + $config['maxPagesDisplayed'] && $page - 1 + $config['maxPagesDisplayed'] < $totalPages) {
                    $theme_main['content'] .= '<a href=' . $config['blogPath'] . $config['cleanIndex'] . $categoryText . '/page/' . $i . '>[' . $i . ']</a> ...';
                } elseif ($startPage > 1 && $displayed == 0) {
                    $theme_main['content'] .= '... <a href=' . $config['blogPath'] . $config['cleanIndex'] . $categoryText . '/page/' . $i . '>[' . $i . ']</a> ';
                    $displayed = 1;
                } else {
                    $theme_main['content'] .= '<a href=' . $config['blogPath'] . $config['cleanIndex'] . $categoryText . '/page/' . $i . '>[' . $i . ']</a> ';
                }
            } else {
                $theme_main['content'] .= '[' . $i . '] ';
            }
        }
    }
    $theme_main['content'] .= '</center>';
}