Ejemplo n.º 1
0
<?php

/**
 * @version $Header$
 * @package install
 * @subpackage pumps
 */
// keep in mind that most recent blog posts are show at the top of the blog
/**
 * required setup
 */
include_once BLOGS_PKG_PATH . 'BitBlog.php';
$pageHash = array('fSavePage' => TRUE, 'format_guid' => 'tikiwiki', 'title' => 'bitweaver Blog', 'edit' => 'Sample Blog added during the installation process', 'use_title' => 'y', 'max_posts' => '10', 'use_title' => 'on', 'use_find' => 'on', 'allow_comments' => 'on');
$gBlog = new BitBlog();
if ($gBlog->store($pageHash)) {
    $blogPostHash = array(array('fSavePage' => TRUE, 'format_guid' => 'tikiwiki', 'blog_content_id' => array($gBlog->mContentId), 'trackback' => NULL, 'title' => 'Lorem Ipsum', 'edit' => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum molestie lectus quis elit. Suspendisse scelerisque augue vitae ipsum. Maecenas quis enim. Suspendisse at turpis sed sem ullamcorper aliquam. Aliquam pede ligula, auctor vitae, interdum eget, aliquam vitae, magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam varius feugiat neque. Pellentesque varius. Fusce a mi in nulla porta aliquam. Morbi scelerisque, turpis quis sodales blandit, libero lorem faucibus dui, sit amet lacinia sem pede in quam. Pellentesque tempor suscipit sem. Nam sed augue. 

	Nulla blandit. Vestibulum tempor ullamcorper nulla. Pellentesque varius lectus nec urna. Proin volutpat pede in eros. Mauris sit amet pede in neque nonummy congue. Ut vitae felis. Nunc lacinia. Fusce placerat faucibus orci. Ut vel libero et nisl hendrerit pretium. Sed quis quam id augue porta tempus. Nullam ante risus, blandit sed, eleifend eget, imperdiet a, sapien. Vestibulum libero. Phasellus viverra nonummy dui. In ultrices. Pellentesque imperdiet eros vel urna. Maecenas fringilla rutrum sem. Nullam lacinia, ipsum ut euismod scelerisque, mi dolor faucibus eros, in semper magna lorem non risus. Cras nec elit. Etiam egestas. Praesent placerat diam. 

	Donec nec velit. Mauris scelerisque vestibulum ante. Nulla congue commodo lectus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Aenean posuere, magna sit amet pharetra consectetuer, erat sapien ultricies elit, sit amet sollicitudin sem nibh vitae erat. Proin commodo feugiat nunc. Proin in eros. Fusce nec ante. Nulla convallis mi quis arcu. Duis quam. Cras arcu sem, posuere ut, sodales sit amet, blandit eu, orci. Sed tincidunt egestas est. Curabitur tempus, ipsum ut blandit accumsan, odio tellus egestas ipsum, sit amet cursus lacus velit et est. Nulla at sem. Aliquam quam purus, bibendum ut, tristique sollicitudin, interdum eget, ante. Nulla a ligula. Mauris scelerisque sem a odio. Quisque a nunc sed risus eleifend rutrum. Maecenas vitae lacus.
	'), array('fSavePage' => TRUE, 'format_guid' => 'tikiwiki', 'blog_content_id' => array($gBlog->mContentId), 'trackback' => NULL, 'title' => 'Another Blog', 'edit' => 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum molestie lectus quis elit. Suspendisse scelerisque augue vitae ipsum. Maecenas quis enim. Suspendisse at turpis sed sem ullamcorper aliquam. Aliquam pede ligula, auctor vitae, interdum eget, aliquam vitae, magna. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Etiam varius feugiat neque. Pellentesque varius. Fusce a mi in nulla porta aliquam. Morbi scelerisque, turpis quis sodales blandit, libero lorem faucibus dui, sit amet lacinia sem pede in quam. Pellentesque tempor suscipit sem. Nam sed augue. 

	Nulla blandit. Vestibulum tempor ullamcorper nulla. Pellentesque varius lectus nec urna. Proin volutpat pede in eros. Mauris sit amet pede in neque nonummy congue. Ut vitae felis. Nunc lacinia. Fusce placerat faucibus orci. Ut vel libero et nisl hendrerit pretium. Sed quis quam id augue porta tempus. Nullam ante risus, blandit sed, eleifend eget, imperdiet a, sapien. Vestibulum libero. Phasellus viverra nonummy dui. In ultrices. Pellentesque imperdiet eros vel urna. Maecenas fringilla rutrum sem. Nullam lacinia, ipsum ut euismod scelerisque, mi dolor faucibus eros, in semper magna lorem non risus. Cras nec elit. Etiam egestas. Praesent placerat diam. 
	'), array('fSavePage' => TRUE, 'format_guid' => 'tikiwiki', 'blog_content_id' => array($gBlog->mContentId), 'trackback' => NULL, 'title' => 'Welcome', 'edit' => 'This is the blogs package of bitweaver. A blog is short for __web log__ and is basically a journal that is available on the web. The activity of updating a blog is "blogging" and someone who keeps a blog is a "blogger." Blogs are typically updated daily using software that allows people with little or no technical background to update and maintain the blog. Postings on a blog are almost always arranged in cronological order with the most recent additions featured most prominantly.

	If you have added the __Package Wiki__ to your isntallation and added the wiki sample data, you will notice that it is possible to link to those pages using simple wiki words such as bitweaverGlossary.
	'));
    foreach ($blogPostHash as $blogPost) {
        $newPost = new BitBlogPost(NULL);
        if ($newPost->store($blogPost)) {
            $pumpedData['Blog'][] = $blogPost['title'];
Ejemplo n.º 2
0
<?php

// $Header$
// get a list of blogs for the selection of the home blog
require_once BLOGS_PKG_PATH . 'BitBlog.php';
$blog = new BitBlog();
$listHash['sort_mode'] = 'created_desc';
$blogList = $blog->getList($listHash);
$gBitSmarty->assignByRef('blogList', $blogList);
if (!empty($_REQUEST["set_blog_home"])) {
    $blog_home = @BitBase::verifyId($_REQUEST['blog_home']) ? $_REQUEST['blog_home'] : NULL;
    $gBitSystem->storeConfig("blog_home", $blog_home, BLOGS_PKG_NAME);
    $gBitSmarty->assign('blog_home', $blog_home);
}
$formBlogLists = array("blog_list_title" => array('label' => 'Title'), "blog_list_description" => array('label' => 'Description'), "blog_list_created" => array('label' => 'Creation date'), "blog_list_lastmodif" => array('label' => 'Last modification time'), "blog_list_user" => array('label' => 'Creator', 'note' => 'The creator of a particular blog.'), "blog_list_posts" => array('label' => 'Posts', 'note' => 'Number of posts submitted to any given blog.'), "blog_list_visits" => array('label' => 'Visits', 'note' => 'Number of times a given blog has been visited.'));
$gBitSmarty->assign('formBlogLists', $formBlogLists);
$formBlogFeatures = array("blog_rankings" => array('label' => 'Rankings', 'note' => 'Enable the use of rankings based on page hits.'), "blog_posts_comments" => array('label' => 'Blog Post Comments', 'note' => 'Allow the addition of comments to blog posts.'), "blog_posts_autosplit" => array('label' => 'Use 2 Text Fields To Auto Split Blog Posts', 'note' => 'Display two text fields when editing a post, for intro and read more sections. Disabling will display one text field and requires use of ...split... to create a read more section'), "blog_ajax_more" => array('label' => 'Ajax Read More', 'note' => 'Ajax the "read more" text inline into the short description lists of posts.'), "blog_show_image" => array('label' => 'Auto Display Primary Attachment', 'note' => 'Blog posts can automatically display any attachment, typically an image, that is marked as the "Primary Attachment" during editing. This is especially useful for automatically inserting a photograph into a post.'), "blog_hide_empty_usr_list" => array('label' => 'Hide empty blog message on user pages', 'note' => 'Enable to hide the "No Records Found" on user\'s blog rolls'));
$gBitSmarty->assign('formBlogFeatures', $formBlogFeatures);
$formBlogInputs = array("blog_top_post_count" => array('label' => 'Top Post Count', 'note' => 'How many posts per blog in the rankings should be shown.'));
$gBitSmarty->assign('formBlogInputs', $formBlogInputs);
$processForm = set_tab();
if ($processForm) {
    $blogToggles = array_merge($formBlogLists, $formBlogFeatures);
    foreach ($blogToggles as $item => $data) {
        simple_set_toggle($item, BLOGS_PKG_NAME);
    }
    /** @TODO: Fix. Lazy error handling to ensure numeric. **/
    $gBitSystem->storeConfig("blog_top_post_count", isset($_REQUEST["blog_top_post_count"]) && is_numeric($_REQUEST["blog_top_post_count"]) ? $_REQUEST["blog_top_post_count"] : "3");
    $gBitSystem->storeConfig("blog_posts_max_list", isset($_REQUEST["blog_posts_max_list"]) && is_numeric($_REQUEST["blog_posts_max_list"]) ? $_REQUEST["blog_posts_max_list"] : "10");
    $gBitSystem->storeConfig("blog_posts_comments", isset($_REQUEST["blog_posts_comments"]) ? 'y' : 'n', BLOGS_PKG_NAME);
    $gBitSystem->storeConfig("blog_list_order", $_REQUEST["blog_list_order"], BLOGS_PKG_NAME);
Ejemplo n.º 3
0
<?php

/**
 * @version $Header$
 * @package blogs
 * @subpackage modules
 */
/**
 * required setup
 */
include_once BLOGS_PKG_PATH . 'BitBlog.php';
//require_once( USERS_PKG_PATH.'BitUser.php' );
global $gQueryUserId, $module_rows, $moduleParams;
$listHash['max_records'] = $module_rows;
$listHash['sort_mode'] = !empty($moduleParams['module_params']['sort_mode']) ? $moduleParams['module_params']['sort_mode'] : 'created_desc';
BitUser::userCollection($moduleParams['module_params'], $listHash);
$blog = new BitBlog();
if ($modBlogs = $blog->getList($listHash)) {
    foreach (array_keys($modBlogs) as $b) {
        $modBlogs[$b]['post'] = $blog->getPost(array('blog_id' => $modBlogs[$b]['blog_id']));
    }
    $_template->tpl_vars['modBlogs'] = new Smarty_variable($modBlogs);
}
$moduleTitle = !empty($moduleParams['title']) ? $moduleParams['title'] : 'Blog Roll';
$_template->tpl_vars['moduleTitle'] = new Smarty_variable($moduleTitle);
Ejemplo n.º 4
0
 function getBlogMemberships($pPostContentId)
 {
     global $gBitSystem;
     $ret = NULL;
     if (@$this->verifyId($pPostContentId)) {
         $bindVars = array((int) $pPostContentId);
         $query = "SELECT b.`content_id` AS hash_key, bpm.*, b.*, lc.*\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "blogs_posts_map` bpm\n\t\t\t\tINNER JOIN\t\t`" . BIT_DB_PREFIX . "blogs`\t\t\t\t b ON b.`content_id` = bpm.`blog_content_id`\n\t\t\t\tINNER JOIN\t\t`" . BIT_DB_PREFIX . "liberty_content`\t\tlc ON lc.`content_id` = b.`content_id`\n\t\t\t\tWHERE bpm.post_content_id = ?";
         if ($ret = $this->mDb->getAssoc($query, $bindVars)) {
             foreach (array_keys($ret) as $blogContentId) {
                 $ret[$blogContentId]['blog_url'] = BitBlog::getDisplayUrlFromHash($ret[$blogContentId]['blog_id']);
             }
         }
     } else {
         $this->mErrors['post_id'] = "Invalid post id.";
     }
     return $ret;
 }
Ejemplo n.º 5
0
         if (!empty($_REQUEST['role_id'])) {
             require_once USERS_PKG_PATH . 'RolePermUser.php';
             $permUser = new BitPermUser();
             $roleData = $permUser->getRoleInfo($_REQUEST['role_id']);
             // dont try and fool me
             if (!empty($roleData)) {
                 $roleName = $roleData['role_name'];
                 $rss->title = $roleName . " Role at " . $gBitSystem->getConfig('site_title');
                 $listHash['role_id'] = $_REQUEST['role_id'];
             }
         }
     }
 }
 if (!empty($_REQUEST['blog_id'])) {
     $listHash['blog_id'] = $_REQUEST['blog_id'];
     $gBlog = new BitBlog($_REQUEST['blog_id']);
     $gBlog->load();
     if (isset($gBlog->mContentId)) {
         // adjust feed title to blog title
         $rss->title = $gBlog->getTitle() . " at " . $gBitSystem->getConfig('site_title');
         if (isset($userName)) {
             $rss->title = $userName . "'s Posts in " . $rss->title;
         }
         $rss->description = $gBlog->parseData();
     }
 }
 $feeds = $blogPost->getList($listHash);
 // set the rss link
 $rss->link = 'http://' . $_SERVER['HTTP_HOST'] . BLOGS_PKG_URL . (!empty($_REQUEST['blog_id']) ? "?blog_id=" . $_REQUEST['blog_id'] : "");
 // get all the data ready for the feed creator
 foreach ($feeds['data'] as $feed) {
Ejemplo n.º 6
0
<?php

/**
 * @version $Header$
 * @package blogs
 * @subpackage modules
 */
/**
 * required setup
 */
include_once BLOGS_PKG_PATH . 'BitBlog.php';
//require_once( USERS_PKG_PATH.'BitUser.php' );
global $gQueryUserId, $moduleParams;
//$params = $moduleParams['module_params'];
$listHash['max_records'] = $moduleParams['module_rows'];
$listHash['sort_mode'] = 'last_modified_desc';
BitUser::userCollection($moduleParams, $listHash);
$blog = new BitBlog();
$ranking = $blog->getList($listHash);
$_template->tpl_vars['modLastModifiedBlogs'] = new Smarty_variable($ranking);
Ejemplo n.º 7
0
 * @package blogs
 * @subpackage functions
 *
 * @copyright Copyright (c) 2004-2006, bitweaver.org
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
 */
/**
 * required setup
 */
require_once '../kernel/setup_inc.php';
$gBitSystem->verifyPackage('blogs');
$gBitSystem->verifyPermission('p_blogs_admin');
require_once BLOGS_PKG_PATH . 'lookup_post_inc.php';
require_once BLOGS_PKG_PATH . 'BitBlog.php';
$gBlog = new BitBlog();
$gBitUser->verifyTicket();
//if crosspost save store it and send us to the post's page
if (isset($_REQUEST['crosspost_post']) || isset($_REQUEST['save_post_exit'])) {
    $crosspost_note = isset($_REQUEST['crosspost_note']) ? $_REQUEST['crosspost_note'] : NULL;
    if ($gContent->isValid() && $gContent->storePostMap($gContent->mInfo, $_REQUEST['blog_content_id'], $crosspost_note)) {
        $gContent->load();
        bit_redirect($gContent->getDisplayUrl());
    }
}
// nuke crosspost if requested
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'remove' && $gContent->isValid()) {
    // confirm first
    if (isset($_REQUEST["confirm"])) {
        //remove it, then relaod the crossposting form
        if ($gContent->expungePostMap($gContent->mInfo['content_id'], array($_REQUEST["blog_content_id"]))) {
Ejemplo n.º 8
0
<?php

/**
 * @version $Header$
 * @package blogs
 * @subpackage modules
 */
/**
 * required setup
 */
include_once BLOGS_PKG_PATH . 'BitBlog.php';
//require_once( USERS_PKG_PATH.'BitUser.php' );
global $gQueryUserId, $module_rows, $module_params;
$listHash['max_records'] = $module_rows;
$listHash['sort_mode'] = 'created_desc';
BitUser::userCollection($module_params, $listHash);
$blog = new BitBlog();
$_template->tpl_vars['modLastCreatedBlogs'] = new Smarty_variable($blog->getList($listHash));
Ejemplo n.º 9
0
<?php

/**
 * @package blogs
 * @subpackage functions
 */
/**
 * required setup
 */
global $gContent;
require_once BLOGS_PKG_PATH . 'BitBlog.php';
require_once LIBERTY_PKG_PATH . 'lookup_content_inc.php';
// if we already have a gContent, we assume someone else created it for us, and has properly loaded everything up.
if (empty($gContent) || !is_object($gContent) || !$gContent->isValid()) {
    // if blog_id supplied, use that
    if (@BitBase::verifyId($_REQUEST['blog_id'])) {
        $gContent = new BitBlog($_REQUEST['blog_id']);
        $gContent->load();
    } elseif (@BitBase::verifyId($_REQUEST['content_id'])) {
        $gContent = new BitBlog(NULL, $_REQUEST['content_id']);
        $gContent->load();
    } else {
        $gContent = new BitBlog();
    }
    $gBitSmarty->assignByRef('gContent', $gContent);
}
Ejemplo n.º 10
0
function migrate_wp_categories()
{
    global $wpdb, $gBitSystem, $gBitSmarty, $gUserMap, $gErrorMap, $gBlogMap, $gMaxBlog;
    // Get info on categories
    $query = "select * from " . $wpdb->table_prefix . "wp_categories WHERE cat_ID > {$gMaxBlog}";
    $blog_data = $wpdb->get_results($query);
    if (!empty($blog_data)) {
        foreach ($blog_data as $blog) {
            //    vd($blog);
            $b = new BitBlog();
            $pParamHash = array();
            $pParamHash['title'] = $blog->cat_name;
            $pParamHash['use_title'] = 'y';
            /** @TODO : Map Posts level to user group.
             * @TODO : Make this options in the prep.
             **/
            $pParamHash['is_public'] = 'y';
            $pParamHash['allow_comments'] = 'y';
            $pParamHash['max_posts'] = 10;
            $pParamHash[LIBERTY_TEXT_AREA] = $blog->category_description;
            //    vd($pParamHash);
            $b->store($pParamHash);
            if (empty($b->mErrors)) {
                $gBlogMap[$blog->cat_ID] = $b->mContentId;
            } else {
                $gErrorMap[] = "Blog: " . $blog->cat_name . " : " . $b->mErrors;
            }
        }
    }
    //  vd($gBlogMap);
    $sql = "INSERT INTO `" . BIT_DB_PREFIX . "blogs_wp_blogs` (`wp_id`, `blog_id`) VALUES (?, ?)";
    foreach ($gBlogMap as $wp_id => $blog_id) {
        if ($wp_id > $gMaxBlog) {
            $gBitSystem->mDb->query($sql, array($wp_id, $blog_id));
        }
    }
}