Example #1
0
 function howManyReferencing()
 {
     $pagecount = $eventcount = $entrycount = 0;
     $placement_descriptions = '';
     $pages = Pages::FindAll();
     if (CALENDAR_INSTALL) {
         $events = Events::FindAll();
     }
     if (BLOG_INSTALL) {
         $entries = Blog_Entries::FindAll();
     }
     $pattern_recog = array("left" => array("{", "{"), "right" => array("}", "}"), "reg" => array("{", "}"));
     foreach ($pattern_recog as $float => $direction) {
         $imagePattern = "*" . $direction[0] . "{2}(" . $this->name . ")" . $direction[1] . "{2}*";
         foreach ($pages as $page) {
             $imageIds = getFilterIds($page->content, $imagePattern);
             //print_r($imageIds);
             if (count($imageIds) >= 1) {
                 $pagecount++;
                 $placement_descriptions .= '<a href="' . get_link('admin/edit_page/' . $page->id) . '">' . $page->display_name . '</a>, ';
             }
         }
         if (CALENDAR_INSTALL) {
             foreach ($events as $event) {
                 $imageIds = getFilterIds($event->description, $imagePattern);
                 if (count($imageIds) >= 1) {
                     $eventcount++;
                 }
             }
         }
         if (BLOG_INSTALL) {
             foreach ($entries as $entry) {
                 $imageIds = getFilterIds($entry->content, $imagePattern);
                 if (count($imageIds) >= 1) {
                     $entrycount++;
                 }
             }
         }
     }
     $message = $pagecount . " Pages";
     if (CALENDAR_INSTALL) {
         $message .= ", " . $eventcount . " Events";
     }
     if (BLOG_INSTALL) {
         $message .= ", " . $entrycount . " Blog Entries";
     }
     return $message . ' | ' . $placement_descriptions;
 }
Example #2
0
 function FindByPagination($perpage, $pagenum, $public = true)
 {
     $last = Blog_Entries::FindLastPage($perpage, $public);
     // Check to see if there is a page number. If not, set it to page 1
     if (!isset($pagenum)) {
         $pagenum = 1;
     }
     // Ensure the page number isn't below one, or more than the maximum pages
     if ($pagenum < 1) {
         $pagenum = 1;
     } elseif ($pagenum > $last) {
         $pagenum = $last;
     }
     // Sets the limit value for the query
     $max = 'LIMIT ' . ($pagenum - 1) * $perpage . ', ' . $perpage;
     $query = 'SELECT * FROM blog_entries';
     $query .= $public ? " WHERE date('" . date("Y-m-d H:i:s") . "') >= date(date) AND public = 1" : '';
     $query .= ' ORDER BY date DESC ' . $max;
     return MyActiveRecord::FindBySQL('Blog_Entries', $query);
 }
Example #3
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);
}
Example #4
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_seo_title(" | " . SITE_NAME);
    $bodyclass = "blog archive";
    if ($var1 == "category") {
        $category = Categories::FindByName($var2);
        $description = $category->get_excerpt(160);
        $page_title = $category->get_seo_title(" | " . $blogarea->get_seo_title() . " | " . SITE_NAME);
        $bodyclass = "blog category-archive";
    }
    if ($var1 == "view" && $var2 != "") {
        $blogitem = Blog_Entries::FindById($var2);
        $description = $blogitem->get_excerpt(160);
        $page_title = $blogitem->get_seo_title(" | " . $blogarea->get_seo_title() . " | " . SITE_NAME);
        $bodyclass = "blog single-entry";
    }
} elseif (CALENDAR_INSTALL && $var0 == CALENDAR_STATIC_AREA) {
    $page_title = "Event Calendar | " . SITE_NAME;
    $bodyclass = "calendar";
    if (getRequestVarAtIndex(5)) {
        $event = Events::FindById(getRequestVarAtIndex(5));
        $description = $event->get_excerpt(160);
        $page_title = $event->get_seo_title(" | Event Calendar | " . SITE_NAME);
        $bodyclass = "calendar single-event";
    } elseif (getRequestVarAtIndex(4)) {
        $page_title = "Event Calendar for " . date('F j, Y', mktime(0, 0, 0, $var3, getRequestVarAtIndex(4), $var2)) . " | " . SITE_NAME;
        $bodyclass = "calendar events-for-day";
function __construct()
{
    // Deconstruct connection string
    $params = @parse_url(MYACTIVERECORD_CONNECTION_STR);
    $host = $params['host'];
    if (isset($params['query'])) {
        $host .= ":{$params['query']}";
    }
    // Open connection
    $link = mysql_connect($host, $params['user'], $params['pass']);
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    } else {
        // select database
        mysql_select_db(str_replace('/', '', $params['path']), $link);
        echo "<span style='color:blue'>Connected successfully</span><br />";
    }
    // 1. Create an Alias table if it does not exist
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'alias'")) == TRUE) {
        echo "1) <span style='color:green'>alias table already exists</span><br />";
    } else {
        $query1 = "CREATE TABLE `alias` (\n                `id` int(11) NOT NULL auto_increment,\n                `alias` varchar(255) NOT NULL default '',\n                `path` varchar(255) NOT NULL default '', \n                PRIMARY KEY  (`id`)\n            ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
        if (mysql_query($query1)) {
            echo "1) <span style='color:blue'>Alias Table Created</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 1</span><br />";
        }
    }
    // 2. Create a Blogs table if it does not exist
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'blogs'")) == TRUE) {
        echo "2) <span style='color:green'>blogs table already exists</span><br />";
    } else {
        $query2 = "CREATE TABLE `blogs` (\n\t\t\t\t`id` int(11) NOT NULL auto_increment,\n\t\t\t\t`name` varchar(512) NOT NULL,\n\t\t\t\t`slug` varchar(512) NOT NULL,\n\t\t\t\t`user_id` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY  (`id`)\n\t\t\t) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;";
        if (mysql_query($query2)) {
            mysql_query("insert into `blogs` values('1','Your Blog','your_blog','1');");
            echo "2) <span style='color:blue'>Blogs Table Created</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 2</span><br />";
        }
    }
    // 3. Create a Blog_Entries table if it does not exist
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'blog_entries'")) == TRUE) {
        echo "3) <span style='color:green'>Blog Entries table already exists</span><br />";
    } else {
        $query3 = "CREATE TABLE `blog_entries` (\n\t\t\t\t`id` int(11) NOT NULL auto_increment,\n\t\t\t\t`title` varchar(512) NOT NULL,\n\t\t\t\t`slug` varchar(512) NOT NULL,\n\t\t\t\t`content` blob NOT NULL,\n\t\t\t\t`date` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,\n\t\t\t\t`template` varchar(255) default null,\n\t\t\t\t`blog_id` int(11) NOT NULL,\n\t\t\t\t`public` tinyint(11) NOT NULL default '0',\n\t\t\t\t`author_id` tinyint(11) NOT NULL default '1',\n\t\t\t\tPRIMARY KEY  (`id`)\n\t\t\t) ENGINE=MyISAM AUTO_INCREMENT=12 DEFAULT CHARSET=latin1;";
        if (mysql_query($query3)) {
            echo "3) <span style='color:blue'>Blog Entries Table Created</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 3</span><br />";
        }
    }
    // 4. Check the pages table and add in the parent_page_id column, use for the newer drafts feature
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `pages` LIKE 'parent_page_id'")) == TRUE) {
        echo "4) <span style='color:green'>Pages > parent_page_id column already exists</span><br />";
    } else {
        $query4 = "ALTER TABLE pages ADD `parent_page_id` int(11) default NULL;";
        if (mysql_query($query4)) {
            echo "4) <span style='color:blue'>Page Parent ID column added to Pages table</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 4</span><br />";
        }
    }
    // 5. Check the PayPalconfig table and make sure the fields are the new names:
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `paypal_config` LIKE 'success_url'")) == TRUE) {
        echo "5) <span style='color:green'>Paypal_config > success_url column did not need to be renamed</span><br />";
    } else {
        $query5 = "ALTER TABLE `paypal_config` CHANGE `return` `success_url` text(0);";
        if (mysql_query($query5)) {
            echo "5) <span style='color:blue'>PayPal column name RETURN changed to SUCCESS_URL</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 5</span><br />";
        }
    }
    // 6. Check the PayPalconfig table and make sure the fields are the new names:
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `paypal_config` LIKE 'cancel_url'")) == TRUE) {
        echo "6) <span style='color:green'>Paypal_config > cancel_url column did not need to be renamed</span><br />";
    } else {
        $query6 = "ALTER TABLE `paypal_config` CHANGE `cancel_return` `cancel_url` text(0);";
        if (mysql_query($query6)) {
            echo "6) <span style='color:blue'>PayPal column name CANCEL_RETURN changed to CANCEL_URL</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 6</span><br />";
        }
    }
    // 7. Add a new column to the Documents table to allow sorting by type
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `documents` LIKE 'file_type'")) == TRUE) {
        echo "7) <span style='color:green'>Documents > file_type column already exists</span><br />";
    } else {
        $query7 = "ALTER TABLE documents ADD `file_type` varchar(6) default NULL;";
        if (mysql_query($query7)) {
            echo "7) <span style='color:blue'>Added the &ldquo;file_type&rdquo; column to Documents</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 7</span><br />";
        }
        // Now, loop through the documents and add in data to the new column
        $documents = Documents::FindAll();
        $count = 0;
        foreach ($documents as $doc) {
            $doc->file_type = $doc->get_filetype();
            $doc->save();
            $count++;
        }
        echo $count . " documents have had a file_type added in the database<br />";
    }
    // 8. Check the Areas table and add the content field if it does not exist:
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `areas` LIKE 'content'")) == TRUE) {
        echo "8) <span style='color:green'>Areas > content column already exists</span><br />";
    } else {
        $query8 = "ALTER TABLE areas ADD `content` text;";
        if (mysql_query($query8)) {
            echo "8) <span style='color:blue'>Added the &ldquo;content&rdquo; column to Areas</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 8</span><br />";
        }
    }
    // 9. Check the Sections table and add the date fields if they do not exist:
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `sections` LIKE 'date_revised'")) == TRUE) {
        echo "9) <span style='color:green'>Sections > date_revised column already exists</span><br />";
    } else {
        $query9 = "ALTER TABLE sections ADD `date_revised` datetime default NULL;";
        if (mysql_query($query9)) {
            echo "9) <span style='color:blue'>Added the &ldquo;date_revised&rdquo; column to Sections</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 9</span><br />";
        }
    }
    // 10. Check the Items table and add the new fields if they do not exist:
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `items` LIKE 'date_created'")) == TRUE) {
        echo "10) <span style='color:green'>Items > date_created column already exists</span><br />";
    } else {
        $query10 = "ALTER TABLE items ADD `date_created` datetime default NULL;";
        if (mysql_query($query10)) {
            echo "10) <span style='color:blue'>Added the &ldquo;date_created&rdquo; column to Items</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 10</span><br />";
        }
    }
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `items` LIKE 'date_revised'")) == TRUE) {
        echo "11) <span style='color:green'>Items > date_revised column already exists</span><br />";
    } else {
        $query11 = "ALTER TABLE items ADD `date_revised` datetime default NULL;";
        if (mysql_query($query11)) {
            echo "11) <span style='color:blue'>Added the &ldquo;date_revised&rdquo; column to Items</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 11</span><br />";
        }
    }
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `items` LIKE 'sku'")) == TRUE) {
        echo "12) <span style='color:green'>Items > sku column already exists</span><br />";
    } else {
        $query12 = "ALTER TABLE items ADD `sku` varchar(255) default NULL;";
        if (mysql_query($query12)) {
            echo "12) <span style='color:blue'>Added the &ldquo;sku&rdquo; column to Items</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 12</span><br />";
        }
    }
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `items` LIKE 'price'")) == TRUE) {
        echo "13) <span style='color:green'>Items > price column already exists</span><br />";
    } else {
        $query13 = "ALTER TABLE items ADD `price` varchar(255) default NULL;";
        if (mysql_query($query13)) {
            echo "13) <span style='color:blue'>Added the &ldquo;price&rdquo; column to Items</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 13</span><br />";
        }
    }
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `items` LIKE 'taxonomy'")) == TRUE) {
        echo "14) <span style='color:green'>Items > taxonomy column already exists</span><br />";
    } else {
        $query14 = "ALTER TABLE items ADD `taxonomy` varchar(255) default NULL;";
        if (mysql_query($query14)) {
            echo "14) <span style='color:blue'>Added the &ldquo;taxonomy&rdquo; column to Items</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 14</span><br />";
        }
    }
    // 15. Add in the Categories table for Blog Entries
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'categories'")) == 1) {
        echo "15) <span style='color:green'>categories table already exists</span><br />";
    } else {
        $query15 = "CREATE TABLE `categories` (\n\t\t\t`id` int(11) NOT NULL auto_increment,\n\t\t\t`name` varchar(255) NOT NULL default '',\n\t\t\t`display_name` varchar(255) NOT NULL default '',\n\t\t\t`content` blob NOT NULL default '',\n\t\t\tPRIMARY KEY  (`id`)\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
        if (mysql_query($query15)) {
            echo "15) <span style='color:blue'>Categories table has been created</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 15</span><br />";
        }
        if (mysql_query("insert into `categories` values('1','uncategorized','Uncategorized','The default category for blog entries that do not get added to any other category');")) {
            echo "<span style='color:green'>The &ldquo;Uncategorized&rdquo; category has been added</span><br />";
        } else {
            echo "<span style='color:red'>Error with adding the Uncategorized category</span><br />";
        }
    }
    // 16. Create the link table needed between blog_entries and categories
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'blog_entries_categories'")) == TRUE) {
        echo "16) <span style='color:green'>blog_entries_categories table already exists</span><br />";
    } else {
        $query16 = "CREATE TABLE `blog_entries_categories` (\n\t\t\t`blog_entries_id` int(11) NOT NULL default '0',\n\t\t\t`categories_id` int(11) NOT NULL default '0'\n\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
        if (mysql_query($query16)) {
            echo "16) <span style='color:blue'>Blog Entries and Categories link table has been created</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 16</span><br />";
        }
    }
    // 17. Modify the Blog_Entries table to include a public option
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `blog_entries` LIKE 'public'")) == TRUE) {
        echo "17) <span style='color:green'>Blog_entries > public column already exists</span><br />";
    } else {
        $query17 = "ALTER TABLE blog_entries ADD `public` tinyint(11) NOT NULL default '0';";
        if (mysql_query($query17)) {
            echo "17) <span style='color:blue'>Added the &ldquo;public&rdquo; column to Blog_Entries</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 17</span><br />";
        }
        // Loop through the blog entries and make them public by default
        $entries = Blog_Entries::FindAll();
        foreach ($entries as $entry) {
            $entry->public = 1;
            $entry->save();
        }
    }
    // 18. Modify the Blog_Entries table to include an author_id
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `blog_entries` LIKE 'author_id'")) == TRUE) {
        echo "18) <span style='color:green'>Blog_entries > author_id column already exists</span><br />";
    } else {
        $query18 = "ALTER TABLE blog_entries ADD `author_id` tinyint(11) NOT NULL default '1';";
        if (mysql_query($query18)) {
            echo "18) <span style='color:blue'>Added the &ldquo;author_id&rdquo; column to Blog_Entries</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 18</span><br />";
        }
        // Loop through the blog entries and add a default author
        $entries = Blog_Entries::FindAll();
        foreach ($entries as $entry) {
            $entry->author_id = 1;
            $entry->save();
        }
    }
    // 19. Modify the Users table to include a display_name
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `users` LIKE 'display_name'")) == TRUE) {
        echo "19) <span style='color:green'>Users > display_name column already exists</span><br />";
    } else {
        $query19 = "ALTER TABLE users ADD `display_name` varchar(255) NOT NULL default '';";
        if (mysql_query($query19)) {
            echo "19) <span style='color:blue'>Added the &ldquo;display_name&rdquo; column to Users</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 19</span><br />";
        }
        $admin = Users::FindByEmail("*****@*****.**");
        $admin->display_name = "J. Hogue";
        if ($admin->save()) {
            echo "&ldquo;J. Hogue&rdquo; added to the display_name field for admin@highchairdesign.com<br />";
        }
    }
    // 20. Modify the Users table to include a is_staff
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `users` LIKE 'is_staff'")) == TRUE) {
        echo "20) <span style='color:green'>Users > is_staff column already exists</span><br />";
    } else {
        $query20 = "ALTER TABLE users ADD `is_staff` tinyint(4) NOT NULL default '0';";
        if (mysql_query($query20)) {
            echo "20) <span style='color:blue'>Added the &ldquo;is_staff&rdquo; column to Users</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 20</span><br />";
        }
    }
    // 21. Modify the Documents table to include an item_id so documents can be attached to an item
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `documents` LIKE 'item_id'")) == TRUE) {
        echo "21) <span style='color:green'>Documents > item_id column already exists</span><br />";
    } else {
        $query21 = "ALTER TABLE documents ADD `item_id` int(11);";
        if (mysql_query($query21)) {
            echo "21) <span style='color:blue'>Added the &ldquo;item_id&rdquo; column to Documents</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 21</span><br />";
        }
    }
    // 22. Modify the Documents table to include a display_order so documents can be attached to an item
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `documents` LIKE 'display_order'")) == TRUE) {
        echo "22) <span style='color:green'>Documents > display_order already exists</span><br />";
    } else {
        $query22 = "ALTER TABLE documents ADD `display_order` int(11) default '1';";
        if (mysql_query($query22)) {
            echo "22) <span style='color:blue'>Added the &ldquo;display_order&rdquo; column to Documents</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 22</span><br />";
        }
    }
    // 23. Ran into a site that did not have the MailBlast table
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'mailblast'")) == TRUE) {
        echo "23) <span style='color:green'>&ldquo;mailblast&rdquo; table already exists</span><br />";
    } else {
        $query23 = "CREATE TABLE `mailblast` (\n                `id` int(11) NOT NULL auto_increment,\n                `date_sent` varchar(75) NOT NULL default 'CURRENT_TIMESTAMP',\n                `email_subject` varchar(255) NOT NULL default '',\n                `content` text NOT NULL,\n                `list_id` int(11) NOT NULL,\n                `hash` varchar(36) NOT NULL,\n                PRIMARY KEY  (`id`)\n            ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
        if (mysql_query($query23)) {
            echo "23) <span style='color:blue'>Mailblast Table Created</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 23</span><br />";
        }
    }
    // 24. Modify the Mailblast table to include a subject field
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM `mailblast` LIKE 'email_subject'")) == TRUE) {
        echo "24) <span style='color:green'>MailBlast > Email_subject already exists</span><br />";
    } else {
        $query24 = "ALTER TABLE mailblast ADD `email_subject` varchar(255) NOT NULL default '';";
        if (mysql_query($query23)) {
            echo "23) <span style='color:blue'>Added the &ldquo;email_subject&rdquo; column to MailBlast</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 24</span><br />";
        }
    }
    // 25. Add a video table
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'videos'")) == TRUE) {
        echo "25) <span style='color:green'>Videos table already exists</span><br />";
    } else {
        $query25 = "CREATE TABLE `videos` (\n              `id` int(11) NOT NULL AUTO_INCREMENT,\n              `slug` varchar(255) NOT NULL,\n              `display_name` varchar(255) NOT NULL,\n              `service` varchar(255) DEFAULT NULL,\n              `embed` varchar(255) DEFAULT NULL,\n              `width` decimal(6,0) DEFAULT NULL,\n              `height` decimal(6,0) DEFAULT NULL,\n              `gallery_id` tinyint(11) DEFAULT NULL,\n              `display_order` tinyint(11) DEFAULT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;";
        if (mysql_query($query25)) {
            echo "25) <span style='color:blue'>Added the &ldquo;video&rdquo; table</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 25</span><br />";
        }
    }
    // 26. Modify the Photos table to include an video_id field
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM photos LIKE 'video_id'")) == TRUE) {
        echo "26) <span style='color:green'>Photos > video_id already exists</span><br />";
    } else {
        $query26 = "ALTER TABLE photos ADD `video_id` int(11) default '0';";
        if (mysql_query($query26)) {
            echo "26) <span style='color:blue'>Added the &ldquo;video_id&rdquo; column to Photos</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 26</span><br />";
        }
    }
    // 27. Add a db table for chunks
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'chunks'")) == TRUE) {
        echo "27) <span style='color:green'>Chunks table already exists</span><br />";
    } else {
        $query27 = "CREATE TABLE `chunks` (\n              `id` tinyint(11) NOT NULL AUTO_INCREMENT,\n              `slug` varchar(256) NOT NULL,\n              `description` text DEFAULT NULL,\n              `full_html` tinyint(1) NOT NULL DEFAULT '0',\n              `content` text NOT NULL,\n              PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
        if (mysql_query($query27)) {
            echo "27) <span style='color:blue'>Added the &ldquo;chunks&rdquo; table</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 27</span><br />";
        }
    }
    // 28. Modify the Photos table to include an entry_id field
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM photos LIKE 'entry_id'")) == TRUE) {
        echo "28) <span style='color:green'>Photos > entry_id already exists</span><br />";
    } else {
        $query28 = "ALTER TABLE photos ADD `entry_id` int(11) default '0';";
        if (mysql_query($query28)) {
            echo "28) <span style='color:blue'>Added the &ldquo;entry_id&rdquo; column to Photos</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 28</span><br />";
        }
    }
    // 29. Modify the Blog_entries table to include a template field
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM blog_entries LIKE 'template'")) == TRUE) {
        echo "29) <span style='color:green'>Blog_entries > template already exists</span><br />";
    } else {
        $query29 = "ALTER TABLE blog_entries ADD `template` varchar(255) default 'default';";
        if (mysql_query($query29)) {
            echo "29) <span style='color:blue'>Added the &ldquo;template&rdquo; column to Blog_entries</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 29</span><br />";
        }
    }
    // 30. Modify the Areas table to include a seo_title field
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM areas LIKE 'seo_title'")) == TRUE) {
        echo "30) <span style='color:green'>Areas > seo_title already exists</span><br />";
    } else {
        $query30 = "ALTER TABLE areas ADD `seo_title` varchar(255) default null;";
        if (mysql_query($query30)) {
            echo "30) <span style='color:blue'>Added the &ldquo;seo_title&rdquo; column to Areas</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 30</span><br />";
        }
    }
    // 31. Add a db table for testimonials
    if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'testimonials'")) == TRUE) {
        echo "31) <span style='color:green'>Testimonials table already exists</span><br />";
    } else {
        $query31 = "CREATE TABLE `testimonials` (\n                `id` tinyint(11) NOT NULL AUTO_INCREMENT,\n                `display_name` varchar(256) NOT NULL,\n                `slug` varchar(256) NOT NULL,\n                `content` text NOT NULL,\n                `attribution` varchar(256) NOT NULL,\n                PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;";
        if (mysql_query($query31)) {
            echo "31) <span style='color:blue'>Added the &ldquo;testimonials&rdquo; table</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 31</span><br />";
        }
    }
    // 32. Modify the Blog_Entries table to include an excerpt
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM blog_entries LIKE 'excerpt'")) == TRUE) {
        echo "32) <span style='color:green'>Blog_entries > &ldquo;excerpt&rdquo; column already exists</span><br />";
    } else {
        $query32 = "ALTER TABLE blog_entries ADD `excerpt` text NOT NULL;";
        if (mysql_query($query32)) {
            echo "32) <span style='color:blue'>Added the &ldquo;excerpt&rdquo; column to Blog_Entries</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 32</span><br />";
        }
    }
    // 33. Modify the Testimonials table to include an is_featured boolean
    if (mysql_num_rows(mysql_query("SHOW COLUMNS FROM testimonials LIKE 'is_featured'")) == TRUE) {
        echo "33) <span style='color:green'>Testimonial > &ldquo;is_featured&rdquo; column already exists</span><br />";
    } else {
        $query33 = "ALTER TABLE testimonials ADD `is_featured` tinyint(11) NOT NULL DEFAULT '0';";
        if (mysql_query($query33)) {
            echo "33) <span style='color:blue'>Added the &ldquo;is_featured&rdquo; column to Testimonials</span><br />";
        } else {
            echo "<span style='color:red'>Error with query 33</span><br />";
        }
    }
    mysql_close($link);
}
Example #6
0
function display_page_content()
{
    // Set all values to null by default
    $entry = $entrytitle = $entrypublic = $entrydate = $entryimage = $entrycontent = $entryexcerpt = $entryauthor = $entrytemplate = $preventry = $nextentry = null;
    // Get values from existing object if this is not the Add page
    if (requestIdParam() != 'add') {
        $entry_id = requestIdParam();
        $entry = Blog_Entries::FindById($entry_id);
        $entrytitle = $entry->title;
        $entrypublic = $entry->public;
        $entrydate = $entry->getDateStart();
        if (BLOG_ENTRY_IMAGES) {
            $possibleimage = $entry->getImage();
            if (is_object($possibleimage)) {
                $entryimage = $possibleimage;
            }
        }
        $entrycontent = $entry->content;
        $entryexcerpt = $entry->excerpt;
        $entryauthor = $entry->author_id;
        $entrytemplate = $entry->template;
    }
    // Get other needed objects
    $the_blog = Blogs::FindById(BLOG_DEFAULT_ID);
    $authors = Users::FindAll();
    $categories = Categories::FindAll();
    $thisuser = Users::GetCurrentUser();
    // Get Previous and Next links
    if (is_object($entry)) {
        $preventry = $the_blog->getPrevEntry($entry->date, false);
        $nextentry = $the_blog->getNextEntry($entry->date, false);
    }
    // Warning thrown
    // Double check that the proper columns exist
    $photo_entry_id = find_db_column('photos', 'entry_id');
    if (!$photo_entry_id) {
        echo '<h2 class="system-warning"><span>HCd&gt;CMS says:</span> The Photos table does not have a column called "entry_id"</h2>';
    }
    // Language for the header
    if (is_object($entry)) {
        $header = 'Edit ' . ucwords(BLOG_STATIC_AREA) . ' Entry :: <a href="' . get_link(BLOG_STATIC_AREA . "/view/" . $entry->id . "/" . slug($entry->title)) . '" title="Click to View this Entry (save it first!)">View Entry</a>';
    } else {
        $header = 'Create new ' . ucwords(BLOG_STATIC_AREA) . ' Entry';
    }
    ?>

	<div id="edit-header" class="entrynav threecolumnnav">
		<div class="nav-left column">
			<h1><?php 
    echo $header;
    ?>
</h1>
		</div>
		<div class="nav-center column">
			<?php 
    if (!empty($preventry)) {
        ?>
<a href="<?php 
        echo get_link("/admin/edit_entry/" . $preventry->id);
        ?>
" title="<?php 
        $preventry->the_title();
        ?>
">&larr; Previous Entry</a><?php 
    }
    ?>
		</div>
		<div class="nav-right column">
			<?php 
    if (!empty($nextentry)) {
        ?>
<a href="<?php 
        echo get_link("/admin/edit_entry/" . $nextentry->id);
        ?>
" title="<?php 
        $nextentry->the_title();
        ?>
">Next Entry &rarr;</a><?php 
    }
    ?>
			
		</div>
		<div class="clearleft"></div>
	</div>
	
	<form method="POST" id="edit_entry" enctype="multipart/form-data">
		
		<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">Title:</label>
			<span class="hint">This is the Title of the entry; how it will display in the navigation.</span><br />
			<?php 
    textField("title", $entrytitle, "required: true");
    ?>
		</p>
		
		<div id="entry_date" class="column half">
			
			<p><label for="public">Public: <input type="checkbox" name="public" id="public" <?php 
    if ($entrypublic) {
        ?>
checked="checked"<?php 
    }
    ?>
></label> &nbsp; <span class="hint">Visible or not visible to the public? If you are working on an entry that is not yet ready, leave this off until it is complete. </span></p>
			
			<p>
				<label for="date">Entry Date: </label>
				<input type="text" name="date" id="date" value="<?php 
    echo $entrydate;
    ?>
" />
			</p>
        
        <?php 
    if (!BLOG_ENTRY_IMAGES) {
        ?>
		</div>
		<div class="column half last">
		<?php 
    }
    ?>
        
			<p>
				<label for="author_id">Author:</label> &nbsp; 
				<select name="author_id" id="author_id">
				<?php 
    foreach ($authors as $theauthor) {
        $selected = $theauthor->id == $entryauthor ? ' selected="selected"' : '';
        echo "<option value=\"{$theauthor->id}\"{$selected}> " . $theauthor->get_username() . " </option>\r\n";
    }
    ?>
				
				</select>
			</p>
			
			<?php 
    if (BLOG_ENTRY_TEMPLATES) {
        ?>
			<p>
    			<label for="template">Template:</label>
    			<select id="template" name="template">
    				<?php 
        require_once snippetPath("blog_templates_array");
        foreach ($blog_templates as $template) {
            echo '<option value="' . $template . '"';
            if ($template == $entrytemplate) {
                echo ' selected="selected"';
            }
            echo '>' . $template . '</option>';
        }
        ?>
    				
    			</select>
    		</p>
    		<?php 
    }
    ?>

        <?php 
    if (BLOG_ENTRY_IMAGES) {
        ?>
		</div>
		<div id="entry-thumb" class="column half last">
			
			<!-- Entry image -->
            <div style="padding-bottom: 1em;">
                <p><label for="entry_image"><?php 
        echo empty($entryimage) ? 'Add' : 'Edit';
        ?>
 an Entry Image:</label>
    				<input type="file" name="entry_image" id="entry_image" value="" />
    			</p>
    			<p class="hint">An image may be used by your site design on landing pages or menus. </p>
			<?php 
        if (!empty($entryimage)) {
            echo '<h3>Existing Entry Image (reduced in size)</h3>';
            echo '<p><img src="' . $entryimage->getPublicUrl() . '" style="max-width:100%;" alt=""></p>';
        }
        echo '</div>';
    }
    // end if BLOG_ENTRY_IMAGES
    ?>

		</div>
		
		<p class="clearleft">
			<label for="entry_content">Content:</label><br />
			<?php 
    textArea("entry_content", $entrycontent, 98, EDIT_WINDOW_HEIGHT / 2);
    ?>
		</p>
		
<?php 
    require_once snippetPath("admin-insert_configs");
    ?>
		
		<ul id="gallery-options-nav" class="menu tabs">
			<li><a href="#section_selector" class="openclose opened">Edit Categories for this Entry</a></li>
		</ul>
		<div id="section_selector" class="dropslide">
			<h2><legend>Select a Category to include this Entry in:</legend></h2>
			<fieldset>
				<p>
			<?php 
    $entrycats = is_object($entry) ? $entry->getCategories() : false;
    foreach ($categories as $thecategory) {
        $checked = "";
        if ($entrycats) {
            foreach ($entrycats as $entry_cat) {
                if ($thecategory->id == $entry_cat->id) {
                    $checked = ' checked="checked"';
                }
            }
        }
        echo '<label for="' . slug($thecategory->display_name) . '">' . $thecategory->display_name . '&nbsp;';
        echo '<input name="selected_cats[]" id="' . slug($thecategory->display_name) . '" class="boxes"' . $checked . ' type="checkbox" value="' . $thecategory->id . '" /></label>';
    }
    ?>
				
				</p>					
				<p><span class="hint">Any entry can be in more than one Category. If no categories are selected, this entry will be categorized in the default &ldquo;Uncategorized&rdquo; category.</span></p>
			</fieldset>
		</div><!-- #section_selector -->
        
        
        <p class="clearleft">
			<label for="entry_excerpt">Excerpt:</label><br />
			<?php 
    textArea("entry_excerpt", $entryexcerpt, 98, EDIT_WINDOW_HEIGHT / 3);
    ?>
			<p><span class="hint"><i>Optional:</i> An excerpt is commonly used on landing pages or in special areas, like the meta (SEO) description. Keep it short and limit the use of HTML.</span></p>
		</p>
		
		
		<div id="edit-footer" class="entrynav clearfix">
			<div class="column half">
		
				<p>
					<input type="submit" class="submitbutton" name="submit" value="Save Entry"> <br />
					<input type="submit" class="submitbuttonsmall" name="submit" value="Save and Return to List">
				</p>
				
			</div>
			<div class="column half last">
			
				<p>
				<?php 
    if (is_object($entry)) {
        ?>
					<label for="delete">Delete this entry?</label>
					<input name="delete" class="boxes" type="checkbox" value='<?php 
        echo $entry->id;
        ?>
' />
					<span class="hint">Check the box and then click &ldquo;Save&rdquo; above to delete this entry from the database</span>
				<?php 
    } else {
        echo '&nbsp;';
    }
    ?>
				</p>
			
			</div>
		</div>
		
	</form>
	
	<script type="text/javascript">
	    var entrydate;
		
		$().ready(function() {
			
			$( "#date" ).datetimepicker({
    			showButtonPanel: true,
    			showOtherMonths: true,
    			selectOtherMonths: true,
    			timeFormat: 'hh:mm:ss tt',
    			stepMinute: 5
    		});

			$("#edit_entry").validate({
				rules: {
					title: "required",
				},
				messages: {
					title: "Please enter a title for this <?php 
    echo BLOG_STATIC_AREA;
    ?>
 entry",
				}
			});
		});
	</script>
	
<?php 
}
Example #7
0
 function list_entries_and_group_by_date($blogpost_id = "", $hvalue_years = "h2", $hvalue_months = "h3")
 {
     /* This function draws a sub nav broken down by year and month. Also draws the parts needed to make months collapse. We pass the function an event id in case we want to keep a month open. 
     		Items needed in the CSS:
     			#wrapper h2
     			#wrapper h3
     			#wrapper .month_wrapper
     			#wrapper .month_wrapper a
     		*/
     $blogentries = $this->getEntries(true, true);
     $year = "";
     $month = "";
     $a_month_has_been_opened = false;
     if ($blogpost_id != "") {
         $thisblogpost = Blog_Entries::FindById($blogpost_id);
         $thisblogpost_month = date("Y-m", strtotime($thisblogpost->date));
     }
     if (isset($thisblogpost_month)) {
         //$whereat = $thisblogpost_month;
         $year = date("Y", strtotime($thisblogpost->date));
     } else {
         // Find the first month, and then reset the variables...
         $firstentry = array_shift($blogentries);
         $year = date("Y", strtotime($firstentry->date));
         $month = date("m", strtotime($firstentry->date));
         //$whereat = $year."-".$month;
         array_unshift($blogentries, $firstentry);
     }
     // be sure to reset this variable back to null, as we need it to be null the first time through the foreach
     $month = "";
     /*$string_of_entries = <<<EOT
     <script type="text/javascript">		
     	//<![CDATA[
     	function BlogAlreadyOpen(ul_id)
     	{
     		$('#' + ul_id).show();
     		$('div.month_wrapper').each(function() {
     			if ( $(this).attr('href') == '#' + ul_id ) { $(this).slideDown(); }
     		});
     		return true;
     	}
     	
     	$().ready(function() {
     		BlogAlreadyOpen('{$whereat}');
     		var loc = "";
     		
     		$("a.month_trigger").click(function() {
     			$('.month_wrapper').slideUp();
     			
     			if (loc != $(this).attr('href')) {
     				$($(this).attr('href')).slideDown();
     				loc = $(this).attr('href');
     			} else {
     				loc = "";			
     			}
     			return false;
     		});
     	});
     	//]]>
     </script>	
     EOT;*/
     // First: Output the first year header
     $string_of_entries = "<{$hvalue_years}>{$year}</{$hvalue_years}>\n";
     foreach ($blogentries as $theentry) {
         // Now output the month and save it
         $thisentrymonth = date("Y-m", strtotime($theentry->date));
         $ProperMonth = date("F", strtotime($theentry->date));
         $thisblogpost_month = $showthediv = "";
         if ($month == "") {
             // This is the first time through the loop, as the month is not set yet
             $string_of_entries .= "<{$hvalue_months}><a href=\"#{$thisentrymonth}\" class=\"month_trigger\">{$ProperMonth}</a></{$hvalue_months}>\n";
             $month = $thisentrymonth;
             // First time through, check if there a particular entry to show
             //if ( isset($thisblogpost_month) && $thisblogpost_month != "" ) { $showthediv = " hideme"; }
             // Open the entry wrapper
             $string_of_entries .= "<div id=\"{$month}\" class=\"month_wrapper hideme\">\n";
         } elseif ($month != $thisentrymonth) {
             // Month is set, and it is not the same as this entry's month, so we need a new header
             $string_of_entries .= "</div>\n";
             // Next, check if the year has changed. Output it between the divs
             $thisentryyear = date("Y", strtotime($theentry->date));
             if ($year != $thisentryyear) {
                 $string_of_entries .= "<{$hvalue_years}>{$thisentryyear}</{$hvalue_years}>\n";
                 $year = $thisentryyear;
             }
             $string_of_entries .= "<{$hvalue_months}><a href=\"#{$thisentrymonth}\" class=\"month_trigger\">{$ProperMonth}</a></{$hvalue_months}>\n";
             $month = $thisentrymonth;
             // Second or third time through... check if there is a particular post to show, and whether or not it matches this month we are trying to draw
             //if ( $thisblogpost_month != $thisentrymonth ) { $showthediv = " hideme"; }
             // Open the entry wrapper
             $string_of_entries .= "<div id=\"{$month}\" class=\"month_wrapper hideme\">\n";
         }
         // Finally output the post name and a link
         $string_of_entries .= "<a href=\"" . $theentry->get_URL() . "\">" . $theentry->get_title() . "</a>\n";
     }
     // Close the last month that got opened
     $string_of_entries .= "</div>\n";
     return $string_of_entries;
 }