コード例 #1
0
ファイル: functions.php プロジェクト: MenZil/pluck
function blog_get_reactions($post)
{
    $files = read_dir_contents(BLOG_POSTS_DIR . '/' . $post, 'files');
    if ($files) {
        natcasesort($files);
        $files = array_reverse($files);
        foreach ($files as $reaction) {
            include BLOG_POSTS_DIR . '/' . $post . '/' . $reaction;
            $parts = explode('.', $reaction);
            $reactions[] = blog_get_reaction($post, $parts[0]);
        }
        unset($reaction);
        return $reactions;
    } else {
        return false;
    }
}
コード例 #2
0
ファイル: blog.admin.php プロジェクト: MenZil/pluck
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 
}