Exemple #1
0
 function isPublic()
 {
     // Check the Blog area to see if this thing is public... do not draw pages if it is not
     // Only works on Installs with a SINGLE blog of the default id of 3
     $blogarea = Areas::FindById(3);
     return $blogarea->public;
 }
Exemple #2
0
function display_page_content()
{
    $listname = getRequestVarAtIndex(2);
    switch ($listname) {
        case "portfolio":
            foreach ($_POST as $ordered_objects => $order_value) {
                // splits up the key to see if we are ordering a section, item or ignoring a portfolio area
                $ordered_parts = explode("_", $ordered_objects);
                // NOTICE: I have learned that when there are portfoli orphans, this reordering script breaks. I removed the hidden fields in the Orphans section, but check in on that if you notice reordering breaking again.
                //$debug = "";
                if ($ordered_parts[0] != "PortFolioAreas") {
                    if ($ordered_parts[0] == "SectionOrder") {
                        $section = Sections::FindById($ordered_parts[1]);
                        $section->display_order = $order_value;
                        $section->save();
                        //$debug .= $section->display_name." updated";
                    } else {
                        $section = Sections::FindById($ordered_parts[0]);
                        $item = Items::FindById($ordered_parts[1]);
                        $item->updateOrderInSection($section, $order_value);
                        //$debug .= $item->display_name." updated";
                    }
                }
                //setFlash( "<h3>".$debug."</h3>" );
                //setFlash( "<h3>".var_export( $_POST, true )."</h3>" );
            }
            break;
        case "areaspages":
            foreach ($_POST as $ordered_objects => $order_value) {
                // splits up the key to see if we are ordering a section, item or ignoring a portfolio area
                $ordered_parts = explode("_", $ordered_objects);
                //$debug = "";
                if ($ordered_parts[0] == "AreaOrder") {
                    $area = Areas::FindById($ordered_parts[1]);
                    $area->display_order = $order_value;
                    $area->save();
                    //$debug .= "$area->display_name updated";
                } else {
                    if ($ordered_parts[0] == "SubPage") {
                        $page = Pages::FindById($ordered_parts[1]);
                        $page->display_order = $order_value;
                        $page->save();
                        //$debug .= "$page->display_name sub page updated";
                    } else {
                        $area = Areas::FindById($ordered_parts[0]);
                        $page = Pages::FindById($ordered_parts[1]);
                        $page->updateOrderInArea($area, $order_value);
                        //$debug .= "$page->display_name updated in $area->display_name";
                    }
                }
            }
            //setFlash( "<h3>".$debug."</h3>" );
            //setFlash( "<h3>".var_export( $_POST, true )."</h3>" );
            break;
    }
}
Exemple #3
0
 function updateSelectedAreas($changed_areas)
 {
     $selected_areas = $this->getPortfolioAreas();
     // look for added areas
     foreach ($changed_areas as $changed_area) {
         $found = false;
         foreach ($selected_areas as $selected_area) {
             if ($selected_area->id == $changed_area) {
                 $found = true;
             }
         }
         if (!$found) {
             $tmp_area = Areas::FindById($changed_area);
             $this->attach($tmp_area);
         }
     }
     // look for deleted areas
     foreach ($selected_areas as $selected_area) {
         if (!in_array($selected_area->id, $changed_areas)) {
             //the user has removed this area
             $tmp_area = Areas::FindById($selected_area->id);
             $this->detach($tmp_area);
         }
     }
 }
Exemple #4
0
function display_page_content()
{
    $add_area = requestIdParam() == "add" ? true : false;
    if ($add_area) {
        $area = $is_global = $area_id = $areadisplayname = $areaseotitle = $areaname = $areapublic = $areatemplate = null;
    } else {
        $area_id = requestIdParam();
        $area = Areas::FindById($area_id);
        $is_global = $area->id == 1 ? true : false;
        $areaid = $area->id;
        $areadisplayname = $area->display_name;
        $areaseotitle = $area->seo_title;
        $areaname = $area->name;
        $areapublic = $area->public;
        $areatemplate = $area->template;
    }
    ?>

<div id="edit-header" class="areanav">
	<div class="nav-left column">
		<h1>
    		<?php 
    if ($add_area) {
        echo 'Add Area';
    } else {
        echo 'Edit Area : ';
        echo '<a href="' . $area->get_url() . '" title="View ' . $area->get_url() . '">View Area</a>';
    }
    ?>
        </h1>
	</div>
	<div class="nav-right column"><?php 
    quick_link();
    ?>
</div>
	<div class="clearleft"></div>
</div>

<?php 
    // Start the form
    ?>
<form method="POST" id="js-validate">

	<p class="display_name">
		<label for="display_name">Display Name:</label> 
		<?php 
    textField("display_name", $areadisplayname, "required: true");
    ?>
<br />
		<span class="hint">This is the Proper Name of the area; how it will display in the navigation.</span>
	</p>
		
<?php 
    // If not Index, not a Portfolio Area, and not the Blog area
    if ($is_global != 1 && !strstr($areaname, "_portfolio") && $area_id != 3) {
        if (ALLOW_SHORT_PAGE_NAMES) {
            ?>
	<p>
		<label for="name">Short Name</label> 
		<?php 
            textField("name", $areaname);
            ?>
<br />
		<span class="hint">This is the short name of the page, which gets used in the URL. No spaces, commas, or quotes please.</span>
	</p>
<?php 
        }
    } else {
        hiddenField("name", $areaname);
    }
    if (!$add_area) {
        echo '<p class="page-url">Area URL: <span class="page-url">http://' . SITE_URL . '/<mark>' . ltrim($area->get_url(), "/") . '</mark></span></p>';
    }
    ?>
    
	<div class="column half">
    <?php 
    if (!$is_global) {
        ?>
		<p>
			<label for="public">Public:</label>&nbsp; <?php 
        checkBoxField("public", $areapublic);
        ?>
<br />
			<span class="hint">This determines whether or not the Area will appear in the navigation as a &ldquo;Public&rdquo; link. You may place new pages inside this Area and make them &ldquo;public&rdquo;, but they will still not be visible until the Area is also Public. </span>
		</p>
	<?php 
    } else {
        echo '<p><input type="hidden" name="public" value="1"></p>';
    }
    ?>
	
    </div>
	<div class="column half last">
		<p>
			<label for="seo_title">SEO Title:</label>
			<?php 
    textField("seo_title", $areaseotitle);
    ?>
<br />
			<span class="hint">This title is used in title meta tags (good for SEO). Might also show when a user hovers their mouse over a link. Best to be as short as possible.</span>
		</p>
	</div>
	<div class="clearleft"></div>

    <?php 
    // Template
    ?>
	<p><label for="template">Template:</label>
		<select id="template" name="template">
		<?php 
    $templates = list_available_templates();
    foreach ($templates as $template) {
        $thistemplate = $template == $areatemplate ? ' selected="selected"' : '';
        echo '<option value="' . $template . '"' . $thistemplate . '>' . ucwords($template) . '</option>';
    }
    ?>
		</select><br />
		<span class="hint">When a Page inside this Area uses the template &ldquo;inherit&rdquo;, the Page will inherit this Area&rsquo;s template selection. So, changing this Template may change the display of all Pages within this Area. </span>
	</p>
		
	
	<div id="edit-footer" class="areanav clearfix">
		<div class="column half">
			<p>
				<input type="submit" class="submitbutton" name="submit" value="Save Area" /> <br />
				<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List" />
			</p>
		</div>
		<div class="column half last">
		<?php 
    $user = Users::GetCurrentUser();
    if ($user->has_role() && !in_array($area_id, explode(",", PROTECTED_ADMIN_AREAS)) && requestIdParam() != "add") {
        ?>
		
			<p>
				<label for="delete">Delete this Area?</label>
				<input name="delete" class="boxes" type="checkbox" value="<?php 
        echo $area_id;
        ?>
" />
				<span class="hint">Check the box and then click &ldquo;Edit&rdquo; above to delete from the database. This will move any pages contained within this area to the Global Area, so they do not become Orphans.</span></p>
		<?php 
    } elseif (requestIdParam() != "add") {
        ?>
			
			<p class="red">This area is being protected, it can not be deleted.</p>
		<?php 
    }
    ?>
		</div>
	</div>
		
</form>
	
<script type="text/javascript">
	$().ready(function() {
		$("#js-validate").validate({
			rules : {
				display_name: "required"
			},
			messages: {
				display_name: "Please enter a name you would like to be displayed for this area"
			}
		});
	});

</script>
<?php 
}
Exemple #5
0
function display_page_content()
{
    // Define a function to draw a post... easiest way to manage the output in one place
    function get_entry($thisentry, $link = true, $excerpt = false, $current_user = '')
    {
        $categories = $thisentry->get_categories() != '' ? ' in ' . $thisentry->get_categories() : '';
        $entry = '<article class="entry typography"><header>';
        // If there is an image
        if ($thisentry->template == 'with-image') {
            echo '<p>image</p>';
        }
        if ($link) {
            $entry .= '<h1 class="entry--title"><a href="' . $thisentry->get_url() . '">' . $thisentry->get_title() . '</a></h1>';
        } else {
            $entry .= '<h1 class="entry--title">' . $thisentry->get_title() . '</h1>';
        }
        // If an admin is logged in, set these flags so they can see new posts in the stream.
        if (empty($current_user)) {
            $public = $future = '';
        } else {
            $public = $thisentry->public ? '' : '<span class="entry--notpublic">Not Public</span> ';
            $future = $thisentry->date > date('Y-m-d h:i:s') ? '<span class="entry--future">Future Dated</span> ' : '';
        }
        $entry .= '<p class="entry--date-posted">' . $future . $public . ' <time datetime="' . $thisentry->get_pubdate("c") . '">' . $thisentry->get_pubdate('F j, Y') . '</time>' . $categories . '</p>';
        $entry .= '</header>';
        $entry .= '<div class="entry--content">';
        if ($excerpt) {
            // This preserves HTML and HCD images, but chops on a paragraph and adds a read more.
            $entry .= $thisentry->chopForBlogDigest(480, 'Read the Entire Post');
        } else {
            $entry .= $thisentry->get_content();
        }
        $entry .= '</div></article>' . "\n";
        return $entry;
    }
    function the_entry($thisentry, $link = true, $excerpt = false, $current_user = '')
    {
        echo get_entry($thisentry, $link, $excerpt, $current_user);
    }
    // Start the template
    /* This include sets the following: 
     * $page, $area or $area->is_portfolioarea(), is_object( $current_user )
     * $page_title, $description, $bodyclass, $template
     * getRequestVarAtIndex()s = $var0, $var1, $var2, $var3
     * isset( $blogarea ), isset( $category ), isset( $blogitem )
     */
    $area = Areas::FindById(3);
    include_once snippetPath("header");
    // Still need this to build the navigation and for previous and next posts
    $the_blog = Blogs::FindById(1);
    $entries_per_page = 8;
    $breadcrumbs = '<div class="breadcrumbs"><a class="breadcrumbs--link" href="' . BASEHREF . '">Home</a> <span class="breadcrumbs--sep">&raquo;</span> <a class="breadcrumbs--link" href="' . get_link(BLOG_STATIC_AREA) . '">' . $area->get_title() . '</a>';
    if (!empty($blogitem)) {
        $title = $blogitem->get_title();
        $breadcrumbs .= ' <span class="breadcrumbs--sep">&raquo;</span> <span class="breadcrumbs--link__active">' . chopText($title, 36, ' ') . '&hellip;</span>';
    }
    $breadcrumbs .= '</div>';
    ?>
                        
                        <?php 
    echo $breadcrumbs;
    ?>
                        
                        <div class="default-col">
                        
                            <section class="column" role="main">  
                                <div class="content--main">
<?php 
    // Single post
    if (!empty($blogitem)) {
        $singleentry = get_entry($blogitem, false, false, $current_user);
        $singleentry .= '<footer class="prevnext prevnext__entry" role="navigation"><ul class="prevnext--list menu">';
        // Previous entry link
        $prev = $the_blog->getPrevEntry($blogitem->date);
        $singleentry .= '<li class="prevnext--previous">';
        if (!empty($prev)) {
            $singleentry .= '<a class="prevnext--link prevnext--link__prev" href="' . $prev->get_URL() . '"><h4 class="prevnext--label">Previous:</h4><h2 class="prevnext--title">' . $prev->get_title() . '</h2></a>';
        } else {
            $singleentry .= '&nbsp;';
        }
        $singleentry .= '</li>';
        // Next entry link
        $next = $the_blog->getNextEntry($blogitem->date);
        $singleentry .= '<li class="prevnext--next">';
        if (!empty($next)) {
            $singleentry .= '<a class="prevnext--link prevnext--link__next" href="' . $next->get_URL() . '"><h4 class="prevnext--label">Next</h4><h2 class="prevnext--title">' . $next->get_title() . '</h2></a></li>';
        } else {
            $singleentry .= '&nbsp;';
        }
        $singleentry .= '</li></ul></footer>';
        echo $singleentry;
    } else {
        // Landing page or Filtered page
        echo '<div class="entry--wrapper">';
        $public = is_object($current_user) ? false : true;
        // Check for category
        if (isset($category)) {
            $pagenum = '';
            $entries = $category->getEntries();
            echo '<header class="category--header">';
            $category->the_title('<h1 class="category--title">Posts in <b>&ldquo;', '&rdquo;</b></h1>');
            echo '</header>' . "\n";
            // Check for Year archive
        } elseif ($var1 == 'year' and is_numeric($var2)) {
            $pagenum = '';
            $entries = Blog_Entries::FindByYear($var2, $public);
            echo '<header class="category--header">';
            echo '<h1 class="category--title">Posts from <b>' . $var2 . '</b></h1>';
            echo '</header>' . "\n";
            // Not a category landing page, not a year archive, and not a single item, so, this is the blog landing page
        } else {
            $pagenum = $var1 == "page" ? $var2 : 1;
            $entries = Blog_Entries::FindByPagination($entries_per_page, $pagenum, $public);
        }
        // The list of articles if there is not a single article present
        foreach ($entries as $entry) {
            the_entry($entry, true, true, $current_user);
        }
        // Add some pagination
        if (!empty($pagenum)) {
            ?>

                                    <footer class="pagination">
                                        <ul class="pagination--list menu">
                                        <?php 
            $lastpage = Blog_Entries::FindLastPage($entries_per_page, $public);
            $numbernav = "";
            if ($pagenum > 1) {
                $numbernav .= '<li class="pagination--listitem"><a class="pagination--link pagination--link__prev" href="' . get_link(BLOG_STATIC_AREA . "/page/" . ($pagenum - 1)) . '" title="View Newer Posts">&#9664;</a></li>';
            }
            $counter = 1;
            while ($counter <= $lastpage) {
                $thispage = $counter == $pagenum ? ' pagination--link__disabled' : '';
                $numbernav .= '<li class="pagination--listitem"><a class="pagination--link' . $thispage . '" href="' . get_link(BLOG_STATIC_AREA . "/page/" . $counter) . '">' . $counter . '</a></li>';
                $counter++;
            }
            if ($pagenum != $lastpage) {
                $numbernav .= '<li class="pagination--listitem"><a class="pagination--link pagination--link__next" href="' . get_link(BLOG_STATIC_AREA . "/page/" . ($pagenum + 1)) . '" title="View Older Posts">&#9654;</a></li>';
            }
            echo $numbernav;
            ?>
                                        
                                        </ul>
                                    </footer> 
<?php 
        }
        echo '</div><!-- end .entry--wrapper -->';
    }
    // end if
    ?>
 

                                </div>
                            </section>
                            
                            <aside class="content--sidebar column" role="complementary">
                            <?php 
    // List All the Categories
    // Show/Hide empty ones, show/hide the number of posts, show/hide the 'Uncategorized' category.
    $posts_by_category = $the_blog->list_categories(true, false, true);
    if (!empty($posts_by_category)) {
        echo '<div class="widget widget__categories"><h2 class="widget--title">Categories</h2>' . $posts_by_category . '</div>';
    }
    // List the unique years
    $archive = '<div class="widget widget__archive"><h2 class="widget--title">Archive</h2><ul class="widget--list menu">';
    $allyears = Blog_Entries::FindUniqueYears();
    foreach ($allyears as $year) {
        $archive .= '<li><a href="' . get_link(BLOG_STATIC_AREA . '/year/' . $year->year) . '">' . $year->year . '</a></li>';
    }
    $archive .= '</ul></div>';
    echo $archive;
    ?>
                                
                            </aside>
                        </div><!-- end .default-col -->


<?php 
    include_once snippetPath("footer");
    echo Blogs::DisplayBlogEditLinks(1, $blogitem);
}
Exemple #6
0
        $page_title = $area->get_seo_title(" | " . SITE_NAME);
        $bodyclass = "portarea-{$area->id}";
    }
} else {
    $description = $page->get_excerpt(160);
    $bodyclass = "area-{$area->id} page-{$page->id}";
    if (isset($area) && $area->name == "") {
        // The homepage
        $page_title = $page->get_seo_title();
    } elseif (isset($page)) {
        $page_title = $page->get_seo_title(" | " . $area->get_seo_title() . " | " . SITE_NAME);
    }
}
$bodyclass = $template . ' ' . $bodyclass . ' ' . $admin_class;
if (empty($description)) {
    $globalarea = Areas::FindById(1);
    // Store the default meta description in the Global Area seo_title
    $description = $globalarea->get_seo_title();
}
$description = strip_tags($description);
$current_permalink = "http://" . SITE_URL . BASEHREF . $var0;
if ($var1 != "") {
    $current_permalink .= "/" . $var1;
}
if ($var2 != "") {
    $current_permalink .= "/" . $var2;
}
if ($var3 != "") {
    $current_permalink .= "/" . $var3;
}
if (getRequestVarAtIndex(4) != "") {
Exemple #7
0
    $page = null;
}
// Set the title of the page: Check the strings to do some fancy stuff...
$page_title = $description = $bodyclass = $template = "";
$blogitem = $category = null;
$template = isset($area) && isset($page) ? $page->getTemplateForArea($area) : "no-template-specified";
$current_user = Users::GetCurrentUser();
$admin_class = is_object($current_user) ? ' loggedin' : ' no-loggedin';
$admin_class = is_object(Users::GetCurrentUser()) ? ' loggedin' : '';
// CUSTOM
$var0 = getRequestVarAtIndex(0);
$var1 = getRequestVarAtIndex(1);
$var2 = getRequestVarAtIndex(2);
$var3 = getRequestVarAtIndex(3);
if (BLOG_INSTALL && $var0 == BLOG_STATIC_AREA) {
    $blogarea = Areas::FindById(3);
    // Might need to change this on a per project basis
    $page_title = $blogarea->get_title() . " | " . SITE_NAME;
    $bodyclass = "blog archive";
    if ($var1 == "category") {
        $category = Categories::FindByName($var2);
        $description = $category->get_excerpt(160);
        $page_title = $category->get_title() . " | " . $blogarea->get_title() . " | " . SITE_NAME;
        $bodyclass = "blog category-archive";
    } elseif ($var2 == "page") {
        $description = '';
        $page_title = "Page {$var3} | " . $blogarea->get_title() . " | " . SITE_NAME;
        $bodyclass = "blog page-archive";
    } elseif ($var2 != "") {
        $blogitem = Blog_Entries::FindById($var2);
        $description = $blogitem->get_excerpt(160);
Exemple #8
0
 function checkAlias($selected_areas, $name)
 {
     foreach ($selected_areas as $areaid) {
         $area = Areas::FindById($areaid);
         $aliases = Alias::FindBySql('alias', "SELECT * FROM alias WHERE path LIKE '/{$area->name}/{$name}%' OR path LIKE '{$area->name}/{$name}%'");
         if (count($aliases)) {
             foreach ($aliases as $alias) {
                 $alias->path = "/{$area->name}/" . $this->name;
                 $alias->save();
             }
         }
     }
     return false;
 }
function display_page_content()
{
    $area_id = requestIdParam();
    $area = Areas::FindById($area_id);
    $user = Users::GetCurrentUser();
    ?>

	<script type="text/javascript">
		$().ready(function() {
			$("#add_area").validate({
				rules : {
					display_name: "required"
				},
				messages: {
					display_name: "Please enter a name you would like to be displayed for this area"
				}
			});
		});
	</script>
	
	<div id="edit-header" class="portareanav">
		<h1>Edit Portfolio Area : <a href="<?php 
    $area->the_url();
    ?>
" title="View <?php 
    $area->the_url();
    ?>
">View Area</a></h1>
	</div>
	
	<form method="POST" id="add_area">
		<p><span class="hint">If a text box is underlined in red, it is a required field</span></p>
		
		<p class="display_name">
			<label for="display_name">Display Name:</label>
			<input type="text" name="display_name" value="<?php 
    echo $area->display_name;
    ?>
" class="required: true" /><br />
			<span class="hint">This is the Proper Name of the area; how it will display in the navigation. Keep it simple, but use capitals and spaces, please. </span>
		</p>
		
		<p>
			<label for="seo_title">Title (for SEO):</label>
			<?php 
    textField("seo_title", $area->seo_title);
    ?>
<br />
			<span class="hint">This title is used in title meta tags (good for SEO). Might also show when a user hovers their mouse over a link. </span>
		</p>
		
		<div id="public" class="column half">
			<p>
				<label for="public">Public:</label>&nbsp; <?php 
    checkBoxField("public", $area->public);
    ?>
<br />
				<span class="hint">This determines whether or not the Portfolio Area will appear in the navigation as a &ldquo;Public&rdquo; link. If this Portfolio Area is not public, then no sections within it &ndash; Public or not &ndash; will be visible. A nice way to create a new Portfolio Area is to make the Portfolio Area NOT Public, and all the sections within it Public, so one click can turn it all on when it is ready. </span>
			</p>
		
		</div>
		<div id="template" class="column half">
			<p><label for="template">Template:</label>
				<select id="template" name="template">
				<?php 
    $templates = list_available_templates();
    foreach ($templates as $template) {
        $text = $template;
        echo "<option value=\"{$template}\"";
        if ($template == $area->template) {
            echo " selected=\"selected\"";
        }
        echo ">{$text}</option>";
    }
    ?>
				
				</select><br />
				<span class="hint">When a Page inside this Area uses the template &ldquo;inherit&rdquo;, the Page will inherit this Area&rsquo;s template selection. So, changing this Template may change the display of all Pages within this Area. </span>
			</p>
		</div>
		<div class="clearleft"></div>
		
		<p><label for="area_content">Portfolio Area Description (optional):</label>
			<?php 
    textArea("area_content", $area->content, 98, EDIT_WINDOW_HEIGHT);
    ?>
		
		</p>
<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
		
		
		<div id="edit-footer" class="portareanav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Edit Area" /> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Edit and Return to List" />
				</p>
				
			</div>
			<div class="column half last">
				
			<?php 
    if ($user->has_role() && !in_array($area->id, explode(",", PROTECTED_ADMIN_AREAS))) {
        ?>
				
				<p><label for="delete">Delete this Area? <input name="delete" id="delete" class="boxes" type="checkbox" value="<?php 
        echo $area->id;
        ?>
"></label>
				<span class="hint">Check the box and click &ldquo;Edit&rdquo; to delete from the database. Any sections or items contained within will become orphans and will be shown in the list for reassignment.</span></p>
			<?php 
    } else {
        ?>
		
				<p>This area is being protected, it can not be deleted.</p>
			<?php 
    }
    ?>
			
			</div>
		</div>
		
	</form>
<?php 
}