protected function processRecord($record, $columnMap, &$result, $preview = false)
 {
     foreach ($this->listeners['beforeProcessRecord'] as $listener) {
         $listener($record, $columnMap, $result, $preview);
     }
     $page = $this->getPage($record);
     if (!$page) {
         // Mainly for testing, in real imports the posts should be present already
         if (!($holder = $this->_cache_holder)) {
             $holder = BlogHolder::get()->First();
         }
         if (!$holder) {
             $holder = new BlogHolder();
             $holder->write();
         }
         $this->_cache_holder = $holder;
         $page = new BlogEntry(array('DrupalNid' => $record['nid'], 'ParentID' => $holder->ID));
         $page->write();
     }
     $record['ParentID'] = $page->ID;
     $record['BaseClass'] = 'SiteTree';
     $objId = parent::processRecord($record, $columnMap, $result, $preview);
     $obj = Comment::get()->byId($objId);
     // Created gets overwritten on new records...
     $obj->Created = $record['Created'];
     $obj->write();
     foreach ($this->listeners['afterProcessRecord'] as $listener) {
         $listener($obj, $record, $columnMap, $result, $preview);
     }
     return $objId;
 }
    /**
     * Reads the input parameters and sets up the comment preview action.
     *
     * @param array $p_input
     */
    public function __construct(array $p_input)
    {
        $this->m_defined = true;
        $this->m_name = 'preview_blogcomment';
        $this->m_error = null;

        $BlogEntry = new BlogEntry($p_input['f_blogentry_id']); 
          
        if (!$BlogEntry->exists()) {
            $this->m_error = new PEAR_Error('None or invalid blogentry was given.', ACTION_BLOGCOMMENT_ERR_INVALID_ENTRY);
            return;
        }
        /*
        if (!isset($p_input['f_blogcomment_title']) || empty($p_input['f_blogcomment_title'])) {
            $this->m_error = new PEAR_Error('The comment subject was not filled in.', ACTION_BLOGCOMMENT_ERR_NO_TITLE);
            return;
        }
        */
        if (!isset($p_input['f_blogcomment_content']) || empty($p_input['f_blogcomment_content'])) {
            $this->m_error = new PEAR_Error('The comment content was not filled in.', ACTION_BLOGCOMMENT_ERR_NO_CONTENT);
            return;
        }
        
        $this->m_properties['title'] = $p_input['f_blogcomment_title'];
        $this->m_properties['content'] = $p_input['f_blogcomment_content'];
        $this->m_properties['mood'] = new MetaTopic($p_input['f_blogcomment_mood_id']);
        $this->m_properties['user_name'] = $p_input['f_blogcomment_user_name'];
        $this->m_properties['user_email'] = $p_input['f_blogcomment_user_email'];
    }
Example #3
0
 function createHandler($p)
 {
     $session = SessionHandler::getInstance();
     $o = new BlogEntry();
     $o->owner = $session->id;
     $o->subject = trim($p['subject']);
     $o->body = trim($p['body']);
     $o->time_created = sql_datetime(time());
     $o->time_published = sql_datetime(time());
     $o->id = $o->store();
     js_redirect('a/blogs/overview');
 }
 function doUpload($data, $form)
 {
     // Gets a blog holders ID
     $blogHolderID = $data['BlogHolderID'];
     // Checks if a file is uploaded
     if (is_uploaded_file($_FILES['XMLFile']['tmp_name'])) {
         echo '<p>Processing...<br/></p>';
         flush();
         $file = $_FILES['XMLFile'];
         // check file type. only xml file is allowed
         if ($file['type'] != 'text/xml') {
             echo 'Please select Wordpress XML file';
             die;
         }
         $wp = new WpParser($file['tmp_name']);
         $posts = $wp->parse();
         // For testing only
         // TODO: remove $count
         $count = 0;
         echo $count;
         foreach ($posts as $post) {
             $comments = $post['Comments'];
             // create a blog entry
             $entry = new BlogEntry();
             $entry->ParentID = $blogHolderID;
             // $posts array and $entry have the same key/field names
             // so we can use update here.
             var_dump($post);
             $entry->update($post);
             $entry->write();
             $entry->publish("Stage", "Live");
             // page comment(s)
             foreach ($comments as $comment) {
                 $page_comment = new PageComment();
                 $page_comment->ParentID = $entry->ID;
                 $page_comment->update($comment);
                 $page_comment->write();
             }
             // count is used for testing only
             // TODO: remove the next 2 lines
             $count++;
         }
         // delete the temporaray uploaded file
         unlink($file['tmp_name']);
         // print sucess message
         echo 'Complete!<br/>';
         echo 'Please refresh the admin page to see the new blog entries.';
     }
 }
 public function BlogEntry()
 {
     if ($this->Type == 'Blog') {
         return BlogEntry::get()->filter(array('ID' => $this->PostID))->First();
     }
     return false;
 }
 protected function getOrCreatePost($wordpressID)
 {
     if ($wordpressID && ($post = BlogEntry::get()->filter(array('WordpressID' => $wordpressID))->first())) {
         return $post;
     }
     return BlogEntry::create();
 }
Example #7
0
 function testContent()
 {
     $tmpFlag = BlogEntry::$allow_wysiwyg_editing;
     BlogEntry::$allow_wysiwyg_editing = true;
     $entry = $this->objFromFixture('BlogEntry', 'testpost');
     $entry->Content = '<a href="admin">the CMS</a>';
     $this->assertEquals('<a href="admin">the CMS</a>', $entry->Content());
     BlogEntry::$allow_wysiwyg_editing = $tmpFlag;
 }
 function Links()
 {
     Requirements::themedCSS('widgets_headlines');
     $entries = BlogEntry::get()->sort('Date', 'DESC')->limit($this->NumberOfHeadlinesShown);
     if ($field = $this->Config()->get("boolean_field_used_to_identify_headline")) {
         $entries = $entries->filter($this->Config()->get("boolean_field_used_to_identify_headline"), 1);
     }
     return $entries;
 }
 public function updateCMSFields(FieldList $fields)
 {
     $group = Group::get()->filter(array('code' => BlogEntry::config()->defaultGroup))->first();
     $contentAuthors = $group->Members()->map('ID', 'Title');
     $fields->insertAfter(HTMLEditorField::create("Summary")->setRows(4), "Content");
     $fields->insertAfter(UploadField::create("FeatureImage"), "Summary");
     $fields->insertAfter(DropdownField::create('AuthorMemberID', 'Author (Member)', $contentAuthors)->setEmptyString('(Select one)'), 'Date');
     $fields->removeByName('Author');
     $fields->insertAfter(TextField::create('Author', "Guest Author"), "AuthorMemberID");
 }
 public function getCMSFields()
 {
     $f = parent::getCMSFields();
     //$f->removeByName("Content");
     //$gridFieldConfig = GridFieldConfig_RecordEditor::create();
     //$gridFieldConfig->addComponent(new GridFieldSortableRows('SortOrder'));
     /*$gridField = new GridField("StaffTeam", "Staff Teams", StaffTeam::get(), GridFieldConfig_RecordEditor::create());
     		$f->addFieldToTab("Root.Main", $gridField); // add the grid field to a tab in the CMS	*/
     return $f;
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->makeFieldReadonly('Author');
     $attachments = new SortableUploadField('Attachments');
     //SortableUploadField class in in the "sortablefile" module
     $attachments->setFolderName('Uploads/BlogAttachments');
     $attachments->setAllowedExtensions(array('pdf', 'doc', 'docx', 'csv', 'ppt', 'pptx', 'xls', 'xlsx', 'odt', 'ods'));
     $fields->addFieldToTab("Root.Main", $attachments, "Content");
     return $fields;
 }
 function testLevel()
 {
     $entryCount = BlogEntry::get()->count();
     $cat1 = $this->objFromFixture('BlogCategory', 'one');
     $cat2 = $this->objFromFixture('BlogCategory', 'two');
     $cloud = new BlogCategoryCloud();
     $cats = $cloud->Categories();
     $cat1Wrapper = $cats->find('ID', $cat1->ID);
     $this->assertEquals(5, $cat1Wrapper->getLevel());
     $cat2Wrapper = $cats->find('ID', $cat2->ID);
     $this->assertEquals(10, $cat2Wrapper->getLevel());
 }
 public function processform(SS_HTTPRequest $r)
 {
     $entry = BlogEntry::create();
     if ($this->request->postVar('Title') != null) {
         $entry->Title = $this->request->postVar('Title');
         $entry->Content = $this->request->postVar('Content');
         $entry->Tags = $this->request->postVar('Tags');
         $entry->Date = $this->request->postVar('Date');
         $entry->ParentID = $this->request->postVar('ParentID');
         $entry->write();
         $entry->publish('Stage', 'Live');
         $response = new SS_HTTPResponse(_t('Dashboard.Success', 'Successfully Published'), '200');
         $response->setStatusCode(200, _t('Dashboard.Posted', 'Blog Post Published'));
         return $response;
     } else {
         user_error('Blog Title and Content must be present', E_USER_ERROR);
     }
 }
 /**
  * shows only blog entires
  * associated with the currently selected
  * category. the current blog category is determined
  * through the URLParam ID
  * @param SS_HTTPRequest $request
  * @return {mixed} template to renderWith or httpError
  */
 public function category(SS_HTTPRequest $request)
 {
     $params = $this->owner->getURLParams();
     //get the urlSegment safe for the DB
     $urlSegment = Convert::raw2sql($params['ID']);
     if ($urlSegment != NULL && DataList::create('BlogCategory')->where("URLSegment = '{$urlSegment}'")->count() >= 1) {
         //the category exists - get the id
         $category = DataList::create('BlogCategory')->where("URLSegment = '{$urlSegment}'")->first();
         $categoryID = $category->getField('ID');
         //sort order
         $order = '"BlogEntry"."Date" DESC';
         //get the blog entries
         $entries = BlogEntry::get()->where('"BlogEntry" . "ID" = "BlogEntry_BlogCategories" . "BlogEntryID"')->innerJoin('BlogEntry_BlogCategories', 'BlogEntry_BlogCategories.BlogCategoryID =' . $categoryID)->sort($order);
         //wrap in a paginated list
         $list = new PaginatedList($entries, Controller::curr()->request);
         $data = array('BlogEntries' => $list, 'BlogCategory' => $category->getField('Title'));
         return $this->owner->customise($data)->renderWith(array('BlogHolder', 'Page'));
     } else {
         //no category selected
         return $this->owner->httpError(404, "You must select a category or that category doesn't exist");
     }
 }
 /**
  * @return ArrayList of {@link BlogCategoryCloud_Category}
  */
 public function Categories()
 {
     $result = new ArrayList();
     $cats = BlogCategory::get();
     $entries = BlogEntry::get();
     if ($this->holderId) {
         $cats = $cats->filter('ParentID', $this->holderId);
         $entries = $entries->filter('ParentID', $this->holderId);
     }
     $totalEntryCount = $entries->count();
     // TODO Not possible in a single query due to SS3 ORM
     $aggregateQuery = clone $cats->dataQuery()->query();
     $aggregateQuery->addLeftJoin('BlogEntry_BlogCategories', '"BlogEntry_BlogCategories"."BlogCategoryID" = "BlogCategory"."ID"');
     $aggregateQuery->addLeftJoin('BlogEntry', '"BlogEntry_BlogCategories"."BlogEntryID" = "BlogEntry"."ID"');
     $aggregateQuery->setSelect(array('"BlogCategory"."ID"'));
     $aggregateQuery->selectField('COUNT("BlogEntry"."ID")', 'BlogEntryCount');
     $aggregateQuery->setGroupBy(array('"BlogCategory"."ID"'));
     $aggregateResults = array();
     $maxEntryCount = 0;
     foreach ($aggregateQuery->execute() as $v) {
         $aggregateResults[$v['ID']] = $v;
         if ($v['BlogEntryCount'] > $maxEntryCount) {
             $maxEntryCount = $v['BlogEntryCount'];
         }
     }
     foreach ($cats as $cat) {
         $result->push(BlogCategoryCloud_Category::create($cat, $aggregateResults[$cat->ID]['BlogEntryCount'], $totalEntryCount, $maxEntryCount));
     }
     // Sort in-memory since it might be related to dynamic values like frequency
     // TODO Convert frequency calc to subselect and do sorting in SQL
     if ($this->limit) {
         $result = $result->sort($this->limitSortBy);
         $result = $result->limit($this->limit);
     }
     $result = $result->sort($this->sort);
     return $result;
 }
Example #16
0
    /**
     * Gets an blog list based on the given parameters.
     *
     * @param array $p_parameters
     *    An array of ComparisonOperation objects
     * @param string $p_order
     *    An array of columns and directions to order by
     * @param integer $p_start
     *    The record number to start the list
     * @param integer $p_limit
     *    The offset. How many records from $p_start will be retrieved.
     *
     * @return array $issuesList
     *    An array of Issue objects
     */
    public static function GetList($p_parameters, $p_order = null, $p_start = 0, $p_limit = 0, &$p_count)
    {
        global $g_ado_db;

        if (!is_array($p_parameters)) {
            return null;
        }

        // adodb::selectLimit() interpretes -1 as unlimited
        if ($p_limit == 0) {
            $p_limit = -1;
        }

        $selectClauseObj = new SQLSelectClause();

        // sets the where conditions
        foreach ($p_parameters as $param) {
            $comparisonOperation = self::ProcessListParameters($param);
            $leftOperand = strtolower($comparisonOperation['left']);

            if ($leftOperand == 'matchalltopics') {
                // set the matchAllTopics flag
                $matchAllTopics = true;

            } elseif ($leftOperand == 'topic') {
                // add the topic to the list of match/do not match topics depending
                // on the operator
                if ($comparisonOperation['symbol'] == '=') {
                    $hasTopics[] = $comparisonOperation['right'];
                } else {
                    $hasNotTopics[] = $comparisonOperation['right'];
                }
            } else {
                $comparisonOperation = self::ProcessListParameters($param);
                if (empty($comparisonOperation)) {
                    continue;
                }

                $whereCondition = $comparisonOperation['left'] . ' '
                . $comparisonOperation['symbol'] . " '"
                . $g_ado_db->escape($comparisonOperation['right']) . "' ";
                $selectClauseObj->addWhere($whereCondition);
            }
        }

        if (count($hasTopics) > 0) {
            if ($matchAllTopics) {
                foreach ($hasTopics as $topicId) {
                    $sqlQuery = self::BuildTopicSelectClause(array($topicId));
                    $whereCondition = "plugin_blog_entry.entry_id IN (\n$sqlQuery        )";
                    $selectClauseObj->addWhere($whereCondition);
                }
            } else {
                $sqlQuery = self::BuildTopicSelectClause($hasTopics);
                $whereCondition = "plugin_blog_entry.entry_id IN (\n$sqlQuery        )";
                $selectClauseObj->addWhere($whereCondition);
            }
        }
        if (count($hasNotTopics) > 0) {
            $sqlQuery = self::BuildTopicSelectClause($hasNotTopics, true);
            $whereCondition = "plugin_blog_entry.entry_id IN (\n$sqlQuery        )";
            $selectClauseObj->addWhere($whereCondition);
        }

        // sets the columns to be fetched
        $tmpBlogEntry = new BlogEntry();
        $columnNames = $tmpBlogEntry->getColumnNames(true);
        foreach ($columnNames as $columnName) {
            $selectClauseObj->addColumn($columnName);
        }

        // sets the main table for the query
        $mainTblName = $tmpBlogEntry->getDbTableName();
        $selectClauseObj->setTable($mainTblName);
        unset($tmpBlogEntry);

        if (is_array($p_order)) {
            $order = self::ProcessListOrder($p_order);
            // sets the order condition if any
            foreach ($order as $orderField=>$orderDirection) {
                $selectClauseObj->addOrderBy($orderField . ' ' . $orderDirection);
            }
        }

        $sqlQuery = $selectClauseObj->buildQuery();

        // count all available results
        $countRes = $g_ado_db->Execute($sqlQuery);
        $p_count = $countRes->recordCount();

        //get tlimited rows
        $blogEntryRes = $g_ado_db->SelectLimit($sqlQuery, $p_limit, $p_start);

        // builds the array of blog objects
        $blogEntriesList = array();
        while ($blogEntry = $blogEntryRes->FetchRow()) {
            $blogEntryObj = new BlogEntry($blogEntry['entry_id']);
            if ($blogEntryObj->exists()) {
                $blogEntriesList[] = $blogEntryObj;
            }
        }

        return $blogEntriesList;
    } // fn GetList
Example #17
0
	/**
	 * Call this to enable WYSIWYG editing on your blog entries.
	 * By default the blog uses BBCode
	 */
	static function allow_wysiwyg_editing() {
		self::$allow_wysiwyg_editing = true;
	}
 public function LatestPost()
 {
     return $post = BlogEntry::get()->sort("Date", "ASC")->First() ? $post : false;
 }
Example #19
0
}

// Check permissions
if (!$g_user->hasPermission('plugin_blog_admin')) {
    camp_html_display_error(getGS('You do not have the right to manage blogs.'));
    exit;
}

$f_blog_id = Input::Get('f_blog_id', 'int');
$f_entry_id = Input::Get('f_entry_id', 'int');

if (!$f_entry_id) {
    $user_id = $g_user->getUserId();   
}

$BlogEntry = new BlogEntry($f_entry_id, $f_blog_id);

if ($BlogEntry->store($is_admin, $user_id)) {
    camp_html_add_msg(getGS('Post saved.'), 'ok');
    ?>
    <script language="javascript">
        window.opener.location.reload();
        window.close();
    </script>
    <?php
    exit();
}

?>
<head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
Example #20
0
define('PLUGIN_BLOG_ADMIN_MODE', true);
$self = basename(__FILE__);
$self_params = $self.'?';
if ($f_entry_id) $self_params .= "f_entry_id=$f_entry_id&amp;";
if ($f_start)    $self_params .= "f_start=$f_start&amp;";

$BlogCommentsList = new BlogCommentsList($f_start, $parameters);
$total = $BlogCommentsList->getTotalCount();
$count = $BlogCommentsList->getLength();
$pager = new SimplePager($total, $f_length, "f_start", "index.php?f_order=$f_order&amp;", false);

$TotalList = new BlogCommentsList();
$total = $TotalList->count;

if ($f_entry_id) {
    $BlogEntry = new BlogEntry($f_entry_id);
    $Blog = $BlogEntry->getBlog();
    echo camp_html_breadcrumbs(array(
        array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'),
        array(getGS('Blogs'), $Campsite['WEBSITE_URL'] . '/admin/blog/admin/list_blogs.php'),
        array($Blog->getSubject(), 'list_entries.php?f_blog_id=' . $BlogEntry->getProperty('fk_blog_id')),
        array(getGS('List comments') . ': ' . $BlogEntry->getSubject(), ''),
    ));
} else {
    echo camp_html_breadcrumbs(array(
        array(getGS('Plugins'), $Campsite['WEBSITE_URL'] . '/admin/plugins/manage.php'),
        array(getGS('Blogs'), $Campsite['WEBSITE_URL'] . '/admin/blog/admin/list_blogs.php'),
        array(getGS('List all comments'), ''),
    ));
}
Example #21
0
 /**
  * Create default blog setup
  */
 function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $blogHolder = DataObject::get_one('BlogHolder');
     //TODO: This does not check for whether this blogholder is an orphan or not
     if (!$blogHolder) {
         $blogholder = new BlogHolder();
         $blogholder->Title = "Blog";
         $blogholder->URLSegment = "blog";
         $blogholder->Status = "Published";
         $widgetarea = new WidgetArea();
         $widgetarea->write();
         $blogholder->SideBarID = $widgetarea->ID;
         $blogholder->write();
         $blogholder->publish("Stage", "Live");
         $managementwidget = new BlogManagementWidget();
         $managementwidget->ParentID = $widgetarea->ID;
         $managementwidget->write();
         $tagcloudwidget = new TagCloudWidget();
         $tagcloudwidget->ParentID = $widgetarea->ID;
         $tagcloudwidget->write();
         $archivewidget = new ArchiveWidget();
         $archivewidget->ParentID = $widgetarea->ID;
         $archivewidget->write();
         $widgetarea->write();
         $blog = new BlogEntry();
         $blog->Title = _t('BlogHolder.SUCTITLE', "SilverStripe blog module successfully installed");
         $blog->URLSegment = 'sample-blog-entry';
         $blog->Tags = _t('BlogHolder.SUCTAGS', "silverstripe, blog");
         $blog->Content = _t('BlogHolder.SUCCONTENT', "<p>Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in <a href=\"admin\">the CMS</a>.</p>");
         $blog->Status = "Published";
         $blog->ParentID = $blogholder->ID;
         $blog->write();
         $blog->publish("Stage", "Live");
         DB::alteration_message("Blog page created", "created");
     }
 }
Example #22
0
    function store($p_admin, $p_user_id=null)
    {
        require_once 'HTML/QuickForm.php';
        $mask = $this->_getFormMask($p_admin, $p_owner);
        $form = new html_QuickForm('blog_comment', 'post', '', null, null, true);
        FormProcessor::parseArr2Form($form, $mask);

        if ($form->validate() && SecurityToken::isValid()) {
            $data = $form->getSubmitValues();

            foreach ($data['BlogComment'] as $k => $v) {
                // clean user input
                if (!in_array($k, BlogComment::$m_html_allowed_fields)) {
                    $data['BlogComment'][$k] = htmlspecialchars_array($v);
                }
            }

            if ($data['f_comment_id']) {
                foreach ($data['BlogComment'] as $k => $v) {
                    if (is_array($v)) {
                        foreach($v as $key => $value) {
                            if ($value) {
                                $string .= "$key, ";
                            }
                        }
                        $v = substr($string, 0, -2);
                        unset ($string);
                    }
                    $this->setProperty($k, $v);
                }
                BlogEntry::TriggerCounters(BlogComment::GetEntryId($data['comment_id']));
                return true;

            } elseif ($this->create(
                            $data['f_entry_id'],
                            $p_user_id,
                            $data['BlogComment']['user_name'],
                            $data['BlogComment']['user_email'],
                            $data['BlogComment']['title'],
                            $data['BlogComment']['content'],
                            $data['BlogComment']['fk_mood_id'])) {

                // admin and owner can override status setting
                if ($p_admin && $data['BlogComment']['admin_status']) {
                    $this->setProperty('admin_status', $data['BlogComment']['admin_status']);
                }
                if ($p_owner && $data['BlogComment']['status']) {
                    $this->setProperty('status', $data['BlogComment']['status']);
                }

                BlogEntry::TriggerCounters($this->getProperty('fk_entry_id'));
                return true;
            }
        }
        return false;

    }
Example #23
0
        echo $error . '<br />';
    }
}
$idFromGet = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT);
// echo "id from GET: ", $idFromGet, '<br>';
try {
    $stmt = $db->prepare('SELECT * FROM blog_posts_bi WHERE postID = :postID');
    $stmt->bindParam(':postID', $idFromGet);
    $stmt->execute();
    $stmt->setFetchMode(PDO::FETCH_CLASS, 'BlogEntry');
    $row = $stmt->fetch();
} catch (Exception $e) {
    echo $e->getMessage();
}
if (empty($row)) {
    $row = new BlogEntry();
}
print <<<END

\t<form method='post' action="{$hereFunc(htmlspecialchars($_SERVER['PHP_SELF']))}" > 

\t\t<input type='hidden' name='postID' value="{$row->getPostId()}"/>
\t
\t\t<h2 id="frTitle">FRAN&Ccedil;AIS</h2>
\t\t<p>
\t\t\t<label>Titre</label><br />
\t\t\t<input type='text' name='frTitle' value="{$row->getTitle(FRENCH)}">
\t\t</p>

\t\t<p>
\t\t\t<label>D&eacute;scription</label><br />
Example #24
0
<?php

namespace cd;

switch ($this->owner) {
    case 'recent':
        $list = BlogEntry::getRecent(10);
        foreach ($list as $b) {
            echo '<h1>' . $b->subject . '</h1>';
            echo '<i>Written ' . ago($b->time_created) . ' by ' . UserLink::render($b->owner) . '</i><br/>';
            echo nl2br($b->body);
        }
        break;
    default:
        echo 'No handler for view ' . $this->owner;
}
 public function getEntries()
 {
     return BlogEntry::get()->sort('Date DESC');
 }
 public function getCMSFields()
 {
     $fields = parent::getCMSFields();
     $fields->addFieldsToTab('Root.Wordpress', array(new ReadonlyField('WordpressID', 'Wordpress Post ID'), new ReadonlyField('OriginalLink', 'Original Wordpress URL'), new ReadonlyField('OriginalData', 'Original Wordpress Data')));
     return $fields;
 }
Example #27
0
        foreach ($f_blogs as $blog_id) {
            $Blog = new Blog($blog_id);
            $Blog->setProperty('admin_status', $status);
        }
    break;


    case 'entries_set_online':
    case 'entries_set_offline':
    case 'entries_set_pending':
        $f_entries = Input::Get('f_entries', 'array');
        $status = substr($f_action, 12);

        foreach ($f_entries as $entry_id) {
            $BlogEntry = new BlogEntry($entry_id);
            $BlogEntry->setProperty('admin_status', $status);
        }
    break;

    case 'comments_set_online':
    case 'comments_set_offline':
    case 'comments_set_pending':
        $f_comments = Input::Get('f_comments', 'array');
        $status = substr($f_action, 13);

        foreach ($f_comments as $comment_id) {
            $BlogComment = new BlogComment($comment_id);
            $BlogComment->setProperty('admin_status', $status);
        }
    break;
Example #28
0
                    ?>
                    (<?php p($MetaBlogEntry->language->name); ?>)
                </td>

                <td align="center"><?php p($MetaBlogEntry->user->name); ?></td>
                <td align="center"><?php putGS($MetaBlogEntry->status); ?></td>
                <td align="center"><?php putGS($MetaBlogEntry->admin_status); ?></td>
                <td align="center"><?php p($MetaBlogEntry->date); ?></td>
                <td align="center"><?php p($MetaBlogEntry->comments_online); ?> / <?php p($MetaBlogEntry->comments_offline); ?></td>
                <td align="center"><?php p($MetaBlogEntry->feature); ?></td>

                <td align='center'>
                    <?php
                    // get the topics used
                    $topics = array();
                    $BlogEntry = new BlogEntry($MetaBlogEntry->identifier);
                    foreach ($BlogEntry->getTopics() as $Topic) {
                        $topics[] = "{$Topic->getName($BlogEntry->getLanguageId())}";
                    }
                    $topics_list = implode(' | ', $topics);

				    ?>
				    <A title="<?php putGS('Topics'); p(strlen($topics_list) ? ": $topics_list" : ': -') ?>" href="javascript: void(0);" onclick="window.open('topics/popup.php?f_mode=entry_topic&amp;f_blogentry_id=<?php echo $MetaBlogEntry->identifier ?>', 'blogentry_attach_topic', 'scrollbars=yes, resizable=yes, menubar=no, toolbar=no, width=300, height=400, top=200, left=200');"><IMG src="<?php p($Campsite["ADMIN_IMAGE_BASE_URL"]);?>/<?php p($is_admin ? 'add.png' : 'preview.png') ?>" border="0"></A>

                </td>

                <td align='center'>
                    <A HREF="javascript: void(0);" onclick="window.open('comment_form.php?f_entry_id=<?php echo $MetaBlogEntry->identifier ?>', 'edit_comment', 'scrollbars=yes, resizable=yes, menubar=no, toolbar=no, width=600, height=420, top=100, left=100');" ><IMG SRC="<?php echo $Campsite["ADMIN_IMAGE_BASE_URL"]; ?>/add.png" BORDER="0"></A>
                </td>

                <?php if($is_admin) { ?>
Example #29
0
}

switch ($f_mode) {
    case 'blog_topic':// Check permissions
        $f_blog_id = Input::Get('f_blog_id', 'int');
        $topics = Blog::GetTopicTree();
        $Blog = new Blog($f_blog_id);
        $language_id = $Blog->getLanguageId();
        $object = 'BlogTopic';
        $object_id = $f_blog_id;
    break;

    case 'entry_topic':
        $f_blogentry_id = Input::Get('f_blogentry_id', 'int');
        $topics = Blog::GetTopicTree();
        $BlogEntry = new BlogEntry($f_blogentry_id);
        $language_id = $BlogEntry->getLanguageId();
        $object = 'BlogentryTopic';
        $object_id = $f_blogentry_id;
    break;

}

if (!Input::IsValid()) {
	camp_html_display_error(getGS('Invalid input: $1', Input::GetErrorString()), $_SERVER['REQUEST_URI'], true);
	exit;
}
?>
<html>
<head>
    <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
 public function previousPager()
 {
     $page = BlogEntry::get()->filter(array('Date:GreaterThan' => $this->Date, 'ParentID' => $this->ParentID))->sort('Date')->First();
     return $page;
 }