Ejemplo n.º 1
0
function contact_post()
{
    jabRequire("captcha");
    global $jab;
    global $contact;
    // Retrieve model values
    $model['contact'] = $contact;
    $model['name'] = jabRequestParam('Name');
    $model['email'] = jabRequestParam('Email');
    $model['message'] = jabRequestParam('Message');
    if (strlen($model['name']) == 0) {
        $model['errors'][] = "Name is missing";
    }
    if (!jabIsValidEmail($model['email'])) {
        $model['errors'][] = "Invalid email address";
    }
    if (strlen($model['message']) == 0) {
        $model['errors'][] = "You haven't entered a message";
    }
    // Check recapture OK
    $error = jabCheckCaptcha();
    if ($error !== true) {
        $model['errors'][] = $error;
    }
    if (sizeof($model['errors']) > 0) {
        return jabRenderView("contact_view_form.php", $model);
    }
    $model['to'] = $contact['emailTo'];
    $model['from'] = "\"" . $model['name'] . "\" <" . $model['email'] . ">";
    $model['subject'] = $contact['emailSubject'];
    if (!jabRenderMail("contact_email.php", $model)) {
        $model['send_error'] = true;
        jabRenderView("contact_view_form.php", $model);
    } else {
        jabRenderView("contact_view_success.php", null);
    }
}
Ejemplo n.º 2
0
<?php

/////////////////////////////////////////////////////////////////////////////
// blog.php
jabRequire("route;render");
// Route all urls for a blog
function jabRouteBlog($blog)
{
    jabSetAuthContext("blog");
    jabSetRouteHandlerPath(dirname(__FILE__));
    jabRoute("get", $blog['routePrefix'] . "/index/{page}", "blog_controller.php", "index", $blog);
    jabRoute("get", $blog['routePrefix'] . "/fullindex", "blog_controller.php", "fullindex", $blog);
    jabRoute("get", $blog['routePrefix'] . "/drafts", "blog_controller.php", "drafts", $blog);
    jabRoute("get", $blog['routePrefix'] . "/edit/new", "blog_controller.php", "new_post", $blog);
    jabRoute("get", $blog['routePrefix'] . "/edit/{id}", "blog_controller.php", "edit_article_get", $blog);
    jabRoute("post", $blog['routePrefix'] . "/edit/{id}", "blog_controller.php", "edit_article_post", $blog);
    jabRoute("get;post", $blog['routePrefix'] . "/delete/{id}", "blog_controller.php", "delete_post_{httpmethod}", $blog);
    jabRoute("get;post", $blog['routePrefix'] . "/posts/{id}/*", "blog_controller.php", "view_post_{httpmethod}", $blog);
    jabRoute("get", $blog['routePrefix'] . "/comments/accept/{articleid}/{commentid}", "blog_controller.php", "accept_comment", $blog);
    jabRoute("get", $blog['routePrefix'] . "/comments/reject/{articleid}/{commentid}", "blog_controller.php", "reject_comment", $blog);
    jabRoute("get", $blog['routePrefix'] . "/comments/delete/{articleid}/{commentid}", "blog_controller.php", "delete_comment", $blog);
    jabRoute("get", $blog['routePrefix'] . "/feed.rss", "blog_controller.php", "get_rss_feed", $blog);
    jabRoute("get", $blog['routePrefix'] . "/index.rss", "blog_controller.php", "get_rss_feed", $blog);
    jabRoute("get", $blog['routePrefix'] . "/export", "blog_controller.php", "get_export", $blog);
    jabRoute("get;post", $blog['routePrefix'] . "/import", "blog_controller.php", "import_{httpmethod}", $blog);
    jabRoute("get", $blog['routePrefix'] . "/upgrade", "blog_controller.php", "upgrade", $blog);
    jabRouteStaticContent($blog['routePrefix'], $blog['uploadfolder']);
    jabSetRouteHandlerPath(null);
    jabSetAuthContext(null);
}
Ejemplo n.º 3
0
<?php

$view['masterview'] = "master_email";
$view['plaintext'] = $model['message'];
jabRequire("markdown");
jabEnterMarkdown(true);
echo $model['message'];
jabLeaveMarkdown();
Ejemplo n.º 4
0
 function Format()
 {
     jabRequire("markdown");
     return jabMarkdown($this->Content, !$this->ByAuthor);
 }
Ejemplo n.º 5
0
function jabRenderPartialView($file, &$model, $renderContext = "partial")
{
    global $jab;
    // Include theme folder and shared view folders
    $oldpath = get_include_path();
    set_include_path($jab['themeFolder'] . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . $jab['jab_dir'] . "/shared_views");
    if (substr($file, -4) == ".jab") {
        // Load jab file
        $view = jabLoadContent($file);
        if (isset($view['syntax'])) {
            $jab['syntax_language'] = $view['syntax'];
        }
        // Format content
        jabRequire("markdown");
        $view['content'] = jabMarkdown($view['content']);
    } else {
        if (substr($file, -4) == ".php") {
            // Start buffering
            ob_start();
            // Render it
            include $file;
            // Auto close markdown blocks
            while ($jab['markdown_depth'] > 0) {
                jabLeaveMarkdown();
            }
            // Capture it
            $view['content'] = ob_get_contents();
            // End buffering
            ob_end_clean();
        } else {
            throw new Exception("Unknown view extension for view '" . $file . "'");
        }
    }
    // Use a masterview?
    if ($view['masterview'] == "none") {
        // Just echo the content
        echo $view['content'];
    } else {
        // Default masterview?
        if (!isset($view['masterview'])) {
            $view['masterview'] = "master_view";
        }
        // Include the masterview
        include $view['masterview'] . ".php";
    }
    set_include_path($oldpath);
}
Ejemplo n.º 6
0
<?php

jabRequire("forms");
$view['additional_head_tags'] .= "    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"" . blog_link("/feed.rss") . "\" />\n";
$article = $model['article'];
?>
<h1><?php 
echo htmlspecialchars($model['blog']['title']);
?>
</h1>
<h2><?php 
echo htmlspecialchars($model['blog']['description']);
?>
</h2>

<p>Really delete this article?</p>
<form class="mainform" id="theform" method="post" action="<?php 
echo $_SERVER["REQUEST_URI_CLEAN"];
?>
"> 
<?php 
jabHtmlSubmitButton("Yes, delete it", "delete");
jabHtmlSubmitButton("No, keep it", "cancel");
?>
</form> 
 
<hr/>

<div class="blog_article">
<h2><?php 
echo $article->Title;
Ejemplo n.º 7
0
<?php

global $jab;
// Includes
require_once "../jab/jab.php";
jabRequire("auth_single;contact;blog;editor;querystring;recaptcha");
// Check for ?login query string command
if (jabUserName() == null && isset($_REQUEST['login'])) {
    $refpage = jabQueryStringRemove($_SERVER['REQUEST_URI'], 'login');
    jabRedirect("/account/login?referrer=" . urlencode($refpage));
}
// Check for ?phpinfo query string command
if (isset($_REQUEST['phpinfo'])) {
    phpinfo();
    die;
}
/*
// Insert your recaptcha keys here
// Configure recapture keys
jabInitRecaptcha(
	"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
	"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
	);
*/
// Select the theme
jabSetThemeFolder("theme");
// Setup theme related variables
$jab['siteName'] = "My Jab Site";
$jab['siteCopyright'] = "Copright © " . $jab['siteName'];
// Insert your Google tracked id here
// $jab['googlePageTrackerID']="XX-NNNNNNN-N";
Ejemplo n.º 8
0
<?php
jabRequire("forms;captcha");
$article=$model['article'];
$view['additional_head_tags'].="    <link rel=\"alternate\" type=\"application/rss+xml\" title=\"Get RSS 2.0 Feed\" href=\"".blog_link("/feed.rss")."\" />\n";
?>
<h1><?php echo htmlspecialchars($model['blog']['title']) ?></h1>
<h2><?php echo htmlspecialchars($model['blog']['description']) ?></h2>
<script type="text/javascript">
function appendEmail(email)
{
	var field=document.getElementById("ReplyTo");
	if (field.value.length>0)
		field.value += ", " + email;
	else
		field.value = email;
}
</script>
<?php // ---------------- Command Bar----------------- ?>
<p>
<a href="<?php echo blog_link("/index") ?>">Articles</a>
| <a href="<?php echo blog_link("/fullindex") ?>">Full Index</a>
| <a href="<?php echo blog_link("/feed.rss") ?>">RSS Feed</a> 
<?php if (jabCanUser("author")): ?>
| <a href="/<?php echo $model['blog']['routePrefix']?>/drafts">Drafts</a>
| <a href="/<?php echo $model['blog']['routePrefix']?>/edit/new">New Post</a>
</p>
<?php endif ?>
<hr />

<?php // ---------------- Edit Commands ----------------- ?>
<?php if (jabCanUser("author")): ?>
Ejemplo n.º 9
0
function markdown_format_code($markdown_parser, $code)
{
    jabRequire("syntax");
    return jabFormatCode($code);
}