Пример #1
0
function blog_page_admin_editreaction()
{
    global $cont1, $cont2, $cont3, $cont4, $lang, $var1, $var2;
    ?>
		<p>
			<strong><?php 
    echo $lang['blog']['edit_reactions_message'];
    ?>
</strong>
		</p>
	<?php 
    //If form is posted...
    if (isset($_POST['save'])) {
        //Check if everything has been filled in.
        if (empty($cont1)) {
            $error = show_error($lang['contactform']['fields'], 1, true);
        }
        if (filter_input(INPUT_POST, 'cont2', FILTER_VALIDATE_EMAIL) == false) {
            $error = show_error($lang['contactform']['fields'], 1, true);
        }
        if ($_POST['cont3'] != 'http://' && !empty($_POST['cont3']) && filter_input(INPUT_POST, 'cont3', FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED) == false) {
            $error = show_error($lang['contactform']['fields'], 1, true);
        }
        if (empty($cont4)) {
            $error = show_error($lang['contactform']['fields'], 1, true);
        }
        if (!isset($error)) {
            //Save reaction.
            blog_save_reaction($var1, $cont1, $cont2, $cont3, $cont4, $var2);
            redirect('?module=blog&page=editreactions&var1=' . $var1, 0);
        } else {
            echo $error;
        }
    }
    //Include blog post, if it exists.
    $reaction = blog_get_reaction($var1, $var2);
    $reaction['message'] = str_replace('<br />', '', $reaction['message']);
    ?>
		<form method="post" action="">
			<p>
				<label class="kop2" for="cont1"><?php 
    echo $lang['blog']['name'];
    ?>
</label>
				<input name="cont1" id="cont1" type="text" value="<?php 
    echo $reaction['name'];
    ?>
" />
			</p>
			<p>
				<label class="kop2" for="cont2"><?php 
    echo $lang['blog']['email'];
    ?>
</label>
				<input name="cont2" id="cont2" type="text" value="<?php 
    echo $reaction['email'];
    ?>
" />
			</p>
			<p>
				<label class="kop2" for="cont3"><?php 
    echo $lang['blog']['website'];
    ?>
</label>
				<input name="cont3" id="cont3" type="text" value="<?php 
    if (isset($reaction['website'])) {
        echo $reaction['website'];
    }
    ?>
" />
			</p>
			<p>
				<label class="kop2" for="cont4"><?php 
    echo $lang['blog']['message'];
    ?>
</label>
				<textarea name="cont4" id="cont4" rows="5" cols="50"><?php 
    echo $reaction['message'];
    ?>
</textarea>
			</p>
			<?php 
    show_common_submits('?module=blog&amp;page=editreactions&amp;var1=' . $var1);
    ?>
		</form>
	<?php 
}
Пример #2
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 
}
Пример #3
0
     //Include blog functions
     include_once 'data/modules/blog/functions.php';
     //Save all posts in new format
     foreach ($posts as $post) {
         //Get post information
         include_once 'data/settings/modules/blog/' . $post;
         //Get hour and minute from post_time
         list($hour, $minute) = explode(':', $post_time);
         //Save blog post
         $post_seoname = blog_save_post($post_title, $post_category, $post_content, null, mktime($hour, $minute, '00', $post_month, $post_day, $post_year));
         //Check if there are reactions
         if (isset($post_reaction_title)) {
             foreach ($post_reaction_title as $index => $title) {
                 //Get hour and minute from post_reaction_time
                 list($hour, $minute) = explode(':', $post_reaction_time[$index]);
                 blog_save_reaction($post_seoname, $post_reaction_name[$index], 'unknown', 'unknown', $post_reaction_content[$index], null, mktime($hour, $minute, '00', $post_reaction_month[$index], $post_reaction_day[$index], $post_reaction_year[$index]));
             }
         }
         unset($post_reaction_title);
         //Delete post file
         unlink('data/settings/modules/blog/' . $post);
     }
     unset($posts);
     //Delete post index
     unlink('data/settings/modules/blog/post_index.dat');
 }
 //Then check if there are categories to convert
 if (file_exists('data/settings/modules/blog/categories.dat')) {
     //Load them
     $categories = file_get_contents('data/settings/modules/blog/categories.dat');
     //Then in an array