Esempio n. 1
0
function blog_page_site_viewpost()
{
    //Global language variables.
    global $lang;
    //Load blog post.
    if (isset($_GET['post']) && blog_get_post($_GET['post'])) {
        $post = blog_get_post($_GET['post']);
        ?>
		<div id="blog_post">
			<span id="blog_post_info">
				<?php 
        echo $post['date'] . ' ' . $lang['blog']['at'] . ' ' . $post['time'] . ' ' . $lang['blog']['in'] . ' ' . $post['category'];
        ?>
			</span>
			<div id="blog_post_content">
			<?php 
        run_hook('theme_content', array(&$post['content']));
        echo $post['content'];
        ?>
			</div>
		</div>

		<?php 
        //Check if reactions are enabled
        if (module_get_setting('blog', 'allow_reactions') == 'true') {
            ?>
			<div id="blog_reactions">
				<p>
					<?php 
            $number = blog_get_reactions($post['seoname']);
            if ($number) {
                $number = count($number);
                if ($number == 1) {
                    echo $number . ' ' . $lang['blog']['reaction'];
                } else {
                    echo $number . ' ' . $lang['blog']['reactions'];
                }
            } else {
                echo $lang['blog']['no_reactions'];
            }
            ?>
				</p>
				<?php 
            $reactions = blog_get_reactions($_GET['post']);
            if ($reactions) {
                foreach ($reactions as $reaction) {
                    ?>
						<div class="blog_reaction" id="reaction<?php 
                    echo $reaction['id'];
                    ?>
">
							<p class="blog_reaction_name">
								<?php 
                    if (isset($reaction['website'])) {
                        echo '<a href="' . $reaction['website'] . '">' . $reaction['name'] . '</a>:';
                    } else {
                        echo $reaction['name'] . ':';
                    }
                    ?>
							</p>
							<span class="blog_reaction_info">
								<a href="#reaction<?php 
                    echo $reaction['id'];
                    ?>
"><?php 
                    echo $reaction['date'] . ' ' . $lang['blog']['at'] . ' ' . $reaction['time'];
                    ?>
</a>
						</span>
							<p class="blog_reaction_message"><?php 
                    echo $reaction['message'];
                    ?>
</p>
						</div>
					<?php 
                }
            }
            //If form is posted...
            if (isset($_POST['submit'])) {
                //Check if everything has been filled in.
                if (empty($_POST['blog_reaction_name']) || filter_input(INPUT_POST, 'blog_reaction_email', FILTER_VALIDATE_EMAIL) == false || $_POST['blog_reaction_website'] != 'http://' && !empty($_POST['blog_reaction_website']) && filter_input(INPUT_POST, 'blog_reaction_website', FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) == false || empty($_POST['blog_reaction_message'])) {
                    echo '<p class="error">' . $lang['contactform']['fields'] . '</p>';
                } else {
                    blog_save_reaction($_GET['post'], $_POST['blog_reaction_name'], $_POST['blog_reaction_email'], $_POST['blog_reaction_website'], $_POST['blog_reaction_message']);
                    //Redirect user.
                    redirect(SITE_URI . '/' . PAGE_URL_PREFIX . CURRENT_PAGE_SEONAME . BLOG_URL_PREFIX . $_GET['post'], 0);
                }
            }
            ?>
				<form id="blog_post_form" method="post" action="">
					<div>
						<label for="blog_reaction_name"><?php 
            echo $lang['general']['name'];
            ?>
</label>
						<br />
						<input name="blog_reaction_name" id="blog_reaction_name" type="text" />
						<br />
						<label for="blog_reaction_email"><?php 
            echo $lang['general']['email'];
            ?>
</label>
						<br />
						<input name="blog_reaction_email" id="blog_reaction_email" type="text" />
						<br />
						<label for="blog_reaction_website"><?php 
            echo $lang['general']['website'];
            ?>
</label>
						<br />
						<input name="blog_reaction_website" id="blog_reaction_website" type="text" value="http://" />
						<br />
						<label for="blog_reaction_message"><?php 
            echo $lang['general']['message'];
            ?>
</label>
						<br />
						<textarea name="blog_reaction_message" id="blog_reaction_message" rows="7" cols="45"></textarea>
						<br />
						<input type="submit" name="submit" value="<?php 
            echo $lang['general']['send'];
            ?>
" />
					</div>
				</form>
			</div>

		<?php 
            //End of commenting check.
        }
    } else {
        echo $lang['general']['not_found'];
    }
    ?>
	<p>
		<a href="javascript: history.go(-1)" title="<?php 
    echo $lang['general']['back'];
    ?>
">&lt;&lt;&lt; <?php 
    echo $lang['general']['back'];
    ?>
</a>
	</p>
	<?php 
}
Esempio n. 2
0
function blog_page_admin_editreactions()
{
    global $lang, $var1;
    ?>
		<p>
			<strong><?php 
    echo $lang['blog']['edit_reactions_message'];
    ?>
</strong>
		</p>
	<?php 
    //Include blog post, if it exists.
    $reactions = blog_get_reactions($var1);
    if ($reactions) {
        //Display reactions
        foreach ($reactions as $reaction) {
            ?>
				<div class="menudiv">
					<span>
						<img src="data/modules/blog/images/reactions.png" alt="" />
					</span>
					<span class="kop2"><?php 
            echo $reaction['id'];
            ?>
</span>
					<span class="title-page"><?php 
            echo $reaction['name'];
            ?>
</span>
					<span>
						<a href="?module=blog&amp;page=editreaction&amp;var1=<?php 
            echo $var1;
            ?>
&amp;var2=<?php 
            echo $reaction['id'];
            ?>
">
							<img src="data/image/edit.png" alt="<?php 
            echo $lang['blog']['edit_reaction'];
            ?>
" title="<?php 
            echo $lang['blog']['edit_reaction'];
            ?>
" />
						</a>
					</span>
					<span>
						<a href="?module=blog&amp;page=deletereaction&amp;var1=<?php 
            echo $var1;
            ?>
&amp;var2=<?php 
            echo $reaction['id'];
            ?>
">
							<img src="data/image/delete_from_trash.png" alt="<?php 
            echo $lang['blog']['delete_reaction'];
            ?>
" title="<?php 
            echo $lang['blog']['delete_reaction'];
            ?>
" />
						</a>
					</span>
				</div>
			<?php 
        }
        unset($key);
    } else {
        redirect('?module=blog', 0);
    }
    ?>
		<p>
			<a href="?module=blog">&lt;&lt;&lt; <?php 
    echo $lang['general']['back'];
    ?>
</a>
		</p>
	<?php 
}