Example #1
0
 public static function main()
 {
     if (isset($_REQUEST['blog_id'])) {
         $blog = new Blog((int) $_REQUEST['blog_id']);
     } elseif (isset($_REQUEST['id'])) {
         $blog = new Blog((int) $_REQUEST['id']);
     } else {
         $blog = new Blog();
     }
     if (!isset($_REQUEST['action'])) {
         if ($blog->id) {
             $action = 'view_comments';
         } else {
             $action = 'view';
         }
     } else {
         $action = $_REQUEST['action'];
     }
     switch ($action) {
         case 'view_comments':
             Layout::addStyle('blog');
             Layout::addPageTitle($blog->title);
             if (Current_User::allow('blog', 'edit_blog')) {
                 Blog_User::miniAdminList();
             }
             if ($blog->publish_date > time() && !Current_User::allow('blog')) {
                 PHPWS_Core::errorPage('404');
             } else {
                 $content = $blog->view(true, false);
             }
             break;
         case 'view':
             if (isset($_GET['y'])) {
                 $day = 1;
                 $month = 1;
                 $year = $_GET['y'];
                 if (isset($_GET['m'])) {
                     $month = $_GET['m'];
                     if (isset($_GET['d'])) {
                         $day = $_GET['d'];
                         $start_date = mktime(0, 0, 0, $month, $day, $year);
                         $end_date = mktime(23, 59, 59, $month, $day, $year);
                     } else {
                         $start_day = 1;
                         $end_day = (int) date('t', mktime(0, 0, 0, $month, 1, $year));
                         $start_date = mktime(0, 0, 0, $month, 1, $year);
                         $end_date = mktime(0, 0, 0, $month, $end_day, $year);
                     }
                 } else {
                     $start_date = mktime(0, 0, 0, 1, 1, $year);
                     $end_date = mktime(0, 0, 0, 12, 31, $year);
                 }
             } else {
                 $start_date = null;
                 $end_date = null;
             }
             $content = Blog_User::show($start_date, $end_date);
             Layout::add($content, 'blog', 'view', true);
             return;
             break;
         case 'submit':
             if (Current_User::allow('blog', 'edit_blog')) {
                 PHPWS_Core::reroute(PHPWS_Text::linkAddress('blog', array('action' => 'admin', 'tab' => 'new'), 1));
             } else {
                 PHPWS_Core::errorPage(403);
             }
             break;
         default:
             PHPWS_Core::errorPage(404);
             break;
     }
     Layout::add($content);
 }
Example #2
0
    $site['enviroment'] = 'LIVE';
}
$site['media']['photos']['front-page'] = $config->getPhotoAds($site['creator'], 'front');
// LOAD USER DATA
$user = new User();
if (isset($_SESSION) or isset($_COOKIE['fl-user-name'])) {
    $site['user'] = $user->init($_SESSION, $_COOKIE);
    $user_logged_in = new UserDashboard($site['user']['name']);
    $site['user']['profile-photo'] = $profile_photo = $user_logged_in->getProfilePhoto($site['user']['name']);
    $site['user']['media'] = $user_data = $user_logged_in->getUserMedia($site['user']['name'], 'all');
}
$front_page_photos = $config->getPhotoAds($site['creator'], 'front');
shuffle($front_page_photos);
if ($page_title == '') {
    $page_title = $site['title'];
}
if ($meta_tag_photo == '') {
    $meta_tag_photo = "http://freelabel.net/images/fllogo.png";
} else {
    //$meta_tag_photo = "http://freelabel.net/images/fllogo.png";
}
$site_url = 'http://' . $_SERVER['SERVER_NAME'] . '/';
if (EVN == 'DEVELOPMENT' or $_GET['dev']) {
    echo EVN . '<pre>';
    print_r($site);
    echo '</pre>';
    exit;
}
$config->view('head.php', $site);
$config->view('ui.php', $site);
$config->view('footer.php', $site);
Example #3
0
}
/*
 * Blog Controller File
 */
class Blog extends Page
{
    function __construct()
    {
        parent::__construct();
        Page::header('baseMVC - Blog');
    }
}
$blog = new Blog();
$autId = isset($_GET['id']) ? " WHERE SiteUsers.id = {$_GET['id']}" : '';
$data = $blog->callSelectSP('SELECT * FROM (BlogContent left outer join SiteUsers on authorId = SiteUsers.id)' . $autId . ' ORDER BY date DESC');
$blog->view('blog_view', $data);
/*
 * @todo: Module paths and locations (pages on which they should be viewed) should be stored in a db
 */
?>
	
	<aside>
	
	<!-- navigation div with all authors, 10 latest posts, style chooser and RSS -->
	<!--div id="modules">
		<div class="navModule">
			<h3>Our Authors</h3>
			<ul-->
				
			<?php 
//			$get_authors = $blog->callSelectSP('SELECT * FROM BlogAuthors GROUP BY name');