Example #1
0
<?php

$sql = " select distinct blog_article_id,blog_article.title,blog.name,\n                blog_article.post_time, blog.slug as blog_slug,\n                market.slug as market_slug, blog_article_tag.iorder, blog_article.content,\n                blog_article.media_item_id, person.fname, person.lname, person.username\n        from blog_article_tag\n        left join blog_article on blog_article_id=blog_article.id\n        left join blog on blog_article.blog_id = blog.id\n        left join blog_website on blog.id=blog_website.blog_id\n        left join market on blog_article.market_id=market.id\n        left join person on blog_article.author__person_id=person.id\n        where blog_website.status='A'\n        and blog_website.website_id={$website_id}\n        and lower(blog_article_tag.name) ilike lower('{$current_tag}')\n        and blog_article_tag.active=1 and blog_article.active=1\n        and blog_article.status='A'\n        order by blog_article.post_time desc,blog_article_tag.iorder asc\n        limit {$limit}\n        offset {$offset}";
$rs = sql($sql);
echo "<div id='tag-blog-article-results'>";
if ($rs->EOF) {
    $last_page = true;
    include 'noresult.php';
} else {
    $articles = array();
    while (!$rs->EOF) {
        $articles[] = $rs->fields;
        $rs->MoveNext();
    }
    $last_page = count($articles) <= $num_per_page;
    while (count($articles) > $num_per_page) {
        array_pop($articles);
    }
    blog::listing(NULL, NULL, NULL, $articles);
}
echo "</div>";
Example #2
0
/**
* controller
*
* @author     Dac Chartrand <*****@*****.**>
* @license    http://www.fsf.org/licensing/licenses/gpl-3.0.html
*/
function sux($action, $params = null)
{
    switch ($action) {
        case 'admin':
            // --------------------------------------------------------------------
            // Admin
            // --------------------------------------------------------------------
            $admin = new blogAdmin();
            if ($admin->formValidate($_POST)) {
                $admin->formProcess($_POST);
                $admin->formSuccess();
            } else {
                $admin->formBuild($_POST);
            }
            break;
        case 'edit':
            // --------------------------------------------------------------------
            // Edit
            // --------------------------------------------------------------------
            $id = !empty($params[0]) ? $params[0] : null;
            $edit = new blogEdit($id);
            if ($edit->formValidate($_POST)) {
                $edit->formProcess($_POST);
                $edit->formSuccess();
            } else {
                $edit->formBuild($_POST);
            }
            break;
        case 'bookmarks':
            // --------------------------------------------------------------------
            // Scan for bookmarks
            // --------------------------------------------------------------------
            if (empty($params[0]) || !filter_var($params[0], FILTER_VALIDATE_INT)) {
                suxFunct::redirect(suxFunct::makeUrl('/blog'));
            }
            $bm = new blogBookmarks($params[0]);
            if ($bm->formValidate($_POST)) {
                $bm->formProcess($_POST);
                $bm->formSuccess();
            } else {
                $bm->formBuild($_POST);
            }
            break;
        case 'reply':
            // --------------------------------------------------------------------
            // Reply
            // --------------------------------------------------------------------
            if (empty($params[0]) || !filter_var($params[0], FILTER_VALIDATE_INT)) {
                suxFunct::redirect(suxFunct::makeUrl('/blog'));
            }
            $reply = new blogReply($params[0]);
            if ($reply->formValidate($_POST)) {
                $reply->formProcess($_POST);
                $reply->formSuccess();
            } else {
                $reply->formBuild($_POST);
            }
            break;
        case 'view':
            // --------------------------------------------------------------------
            // View
            // --------------------------------------------------------------------
            if (empty($params[0]) || !filter_var($params[0], FILTER_VALIDATE_INT)) {
                suxFunct::redirect(suxFunct::makeUrl('/blog'));
            }
            $blog = new blog();
            $blog->view($params[0]);
            break;
        case 'author':
            // --------------------------------------------------------------------
            // Author
            // --------------------------------------------------------------------
            if (empty($params[0])) {
                suxFunct::redirect(suxFunct::makeUrl('/blog'));
            }
            $blog = new blog();
            $blog->author($params[0]);
            break;
        case 'tag':
            // --------------------------------------------------------------------
            // Tag
            // --------------------------------------------------------------------
            if (empty($params[0])) {
                suxFunct::redirect(suxFunct::makeUrl('/blog'));
            }
            $blog = new blog();
            if ($params[0] == 'cloud') {
                $blog->tagcloud();
            } else {
                $blog->tag($params[0]);
            }
            break;
        case 'category':
            // --------------------------------------------------------------------
            // Category
            // --------------------------------------------------------------------
            if (empty($params[0])) {
                suxFunct::redirect(suxFunct::makeUrl('/blog'));
            }
            $blog = new blog();
            $blog->category($params[0]);
            break;
        case 'month':
            // --------------------------------------------------------------------
            // Month
            // --------------------------------------------------------------------
            $date = !empty($params[0]) ? $params[0] : date('Y-m-d');
            $blog = new blog();
            $blog->month($date);
            break;
        case 'rss':
            // --------------------------------------------------------------------
            // RSS
            // --------------------------------------------------------------------
            $blog = new blog();
            $blog->rss();
            break;
        default:
            // --------------------------------------------------------------------
            // Default
            // --------------------------------------------------------------------
            $blog = new blog();
            $blog->listing();
            break;
    }
}