public function flushfeeds() { global $init; require_once PATH_CORE . '/classes/newswire.class.php'; $nwObj = new newswire(); $nwObj->cleanup(0); set_flash(array('notice' => "Finished flushing feeds.")); redirect(url_for($this->name, 'index')); }
function fetch($option = 'all', $filter = 'all') { // override for if index sends default blank string if ($option == '') { $option = 'all'; } if ($filter == '') { $filter = 'all'; } if (isset($_GET['currentPage'])) { $currentPage = $_GET['currentPage']; } else { $currentPage = 1; } require_once PATH_FACEBOOK . '/classes/actionTeam.class.php'; $this->teamObj = new actionTeam($this->page); require_once PATH_CORE . '/classes/newswire.class.php'; // call before widetip to register template $nwObj = new newswire($this->db); $stories = $nwObj->fetchNewswire($option, $filter, $this->page->session->ui->memberFriends, $currentPage); // build the newswire page $inside = '<div id="col_left"><!-- begin left side -->'; if ($this->page->session->ui->hideTipStories == 0) { $inside .= $nwObj->templateObj->templates[wideTip]; } $inside .= $nwObj->buildStoriesTabs($option); $inside .= '<div id="newswireWrap">'; $inside .= $stories; $inside .= '<!-- end newswireWrap --></div>'; $inside .= '<!-- end left side --></div><div id="col_right">'; $inside .= '<div id="introPanel">'; $inside .= '<p><a href="?p=postStory" onclick="switchPage(\'postStory\');return false;" class="btn_1">Post a story</a></p>'; $inside .= '<!-- end of introPanel --></div>'; $inside .= $this->teamObj->fetchSidePanel('stories'); $inside .= '</div> <!-- end right side -->'; if ($this->page->isAjax) { return $inside; } $code = $this->page->constructPage('stories', $inside); return $code; }
// publish a journal story $fb->publishNewsCloudStory('publishStory', $itemid); $contentid = $itemid; $storyOption = '<li><a href="?p=read&cid=' . $contentid . '" target="_cts">Read the story</a></li>'; break; } if (!$error) { $code = '<div id="dialogMessage"><p>Your story has been published successfully.</p><p>What would you like to do next?</p>'; $code .= '<ul><li><a href="?p=read&cid=' . $contentid . '" onclick="hideDialog(); readStory(' . $contentid . ');return false;">Add a comment</a></li>' . $storyOption . '<li><a href="#" onclick="hideDialog(); return shareStory(this,' . $cid . ');">Share story with friends</a>Share story with friends</a></li><li><a href="?p=invite" onclick="hideDialog(); switchPage(\'invite\',\'\');return false;">Invite friends to ' . SITE_TITLE . '</a></li></ul></div>'; } else { $code = '<div id="dialogMessage">Sorry, there was a problem publishing your story. Error: ' . $errorMsg . '</div>'; } break; case 'newswire': require_once PATH_FACEBOOK . '/pages/newswire.class.php'; $nwObj = new newswire($this); $code = $nwObj->fetchNewswirePage($userid, $currentPage); break; case 'refreshComments': if (isset($_GET['cid']) and is_numeric($_GET['cid'])) { $cid = $_GET['cid']; } else { $cid = 0; $error = true; $errorMsg = 'No story id'; } if (!$error) { require_once PATH_CORE . '/classes/read.class.php'; $comObj = new read($db, $session); $code = $comObj->fetchComments($cid); $comObj->resetStoryCache($cid);
<?php /* Process incoming variable requests */ if (isset($_GET['action'])) { $action = $_GET['action']; } else { $action = 'unknown'; } if (isset($_GET['userid'])) { $userid = $_GET['userid']; } else { $userid = 0; } if (isset($_GET['itemid'])) { $itemid = $_GET['itemid']; } else { $id = 0; } /* begin building ajax response */ switch ($action) { case 'readWire': require_once PATH_CORE . "/classes/log.class.php"; $logObj = new log($db); $info = $logObj->serialize(0, $userid, 'readWire', $itemid); $logObj->update($info); require_once PATH_CORE . "/classes/newswire.class.php"; $nwObj = new newswire($db); $url = $nwObj->getWebpage($itemid); header("Location: " . $url); break; }
function myStories() { require_once PATH_CORE . '/classes/newswire.class.php'; $nwObj = new newswire($this->db); $code .= '<h2>My Stories</h2>' . $nwObj->fetchPublisherStories('all', 'user', 1); $code .= '<input type="hidden" name="pubType" value="story">'; return $code; }
function fetch($option = 'link') { global $init; require_once PATH_CORE . '/classes/template.class.php'; $this->templateObj = new template($this->db); $this->templateObj->registerTemplates(MODULE_ACTIVE, 'postStory'); // build the post story page if (defined('ENABLE_USER_BLOGGING') and ENABLE_USER_BLOGGING === true) { $inside .= $this->buildSubNav($option) . '<br /><br />'; } switch ($option) { case 'auto': $inside .= $this->buildScriptInclude('auto'); if ($this->session->u->isModerator or $this->session->u->isSponsor or $this->session->u->isAdmin) { // auto posting for moderators - a quicker way to post and feature stories require_once PATH_CORE . '/classes/newswire.class.php'; $nwObj = new newswire($this->db); $stories = $nwObj->fetchRawStories(); $inside .= '<p>This is an experimental page viewable only by administrators to speed up posting stories and featuring them.</p><p><a href="' . URL_HOME . '?p=engine&force=syncLog&apiKey=' . $init['apiKey'] . '" target="_cts">Sync photos now</a></p>'; $inside .= '<div id="newswireWrap">'; $inside .= $stories; $inside .= '<!-- end newswireWrap --></div>'; } else { $inside .= $this->page->buildMessage('error', 'Access Denied', 'You do not have permission to view this page.'); } break; case 'blog': $result = false; if (isset($_GET['editid'])) { $editid = $_GET['editid']; $this->fData = $this->loadBlogDraft($editid); if ($this->fData->status == 'published') { // already published, redirect to story $this->facebook->redirect(URL_CANVAS . '?p=read&cid=' . $fData->siteContentId); exit; } } else { $editid = 0; } if (isset($_GET['submit'])) { $this->validate('blog'); if (!$this->fData->result) { $result = false; $inside .= $this->page->buildMessage('error', 'Problems with your blog entry', $this->fData->alert); } else { switch ($_POST['submit']) { default: // save as draft $this->fData->blogid = $this->saveBlogDraft($this->fData); break; case 'Publish': $status = $this->publishBlog($this->fData); $result = $status[result]; if ($result) { $this->facebook->redirect(URL_CANVAS . '?p=read&cid=' . $status[siteContentId] . '&justPosted' . (isset($_GET['popup']) ? '&viaBookmarklet' : '')); exit; } else { $inside .= $this->page->buildMessage('error', 'Problems with your blog entry', $status[msg]); } break; } } } // if preview if (!$result) { $inside .= $this->buildDraftList(); $inside .= $this->buildPostBlogForm($this->fData); } else { // process story submission $inside = 'Your blog entry has been published'; // redirect to the story page // with message offering other options to share with friends } break; default: $result = false; if (isset($_GET['submit'])) { $this->validate('link'); if (!$this->fData->result) { $result = false; $inside .= $this->page->buildMessage('error', 'Problems with your post', $this->fData->alert); } else { $status = $this->addStory($this->fData); $result = $status[result]; if ($result) { $this->facebook->redirect(URL_CANVAS . '?p=read&cid=' . $status[siteContentId] . '&justPosted' . (isset($_GET['popup']) ? '&viaBookmarklet' : '')); exit; } else { $inside .= $this->page->buildMessage('error', 'Problems with your post', $status[msg]); } } } // if preview OR if (!$result) { $inside .= '<div id="col_left"><!-- begin left side -->'; $inside .= $this->buildPostStoryForm($this->fData); $inside .= '<!-- end left side --></div><div id="col_right">'; $inside .= $this->buildSidePanel(); $inside .= '</div> <!-- end right side -->'; } else { // process story submission $inside = 'Story posted'; // redirect to the story page // with message offering other options to share with friends } break; } if ($this->page->isAjax) { return $inside; } $code = $this->page->constructPage('postStory', $inside); return $code; }
case 'publishWire': if (isset($_GET['itemid'])) { $itemid = $_GET['itemid']; if ($db->ui->isLoggedIn) { require_once PATH_CORE . '/classes/log.class.php'; $logObj = new log($db); $logItem = $logObj->serialize(0, $db->ui->userid, 'publishWire', $itemid); $inLog = $logObj->update($logItem); if ($inLog) { $code = 'Story published!'; } else { $code = 'Story already published!'; } // create temporary content item, temp permalink require_once PATH_CORE . '/classes/newswire.class.php'; $nwObj = new newswire($db); $db->log('call tempcontent'); $siteContentId = $nwObj->createTempContent($db->ui, $itemid); // add to user's journal if ($siteContentId !== false) { // add to journal $logItem = $logObj->serialize(0, $db->ui->userid, 'publishStory', $siteContentId); $inLog = $logObj->update($logItem); $logItem = $logObj->serialize(0, $db->ui->userid, 'vote', $siteContentId); $inLog = $logObj->update($logItem); // add siteContentId into itemid2 of publishWire log entry $db->update("Log", "itemid2={$siteContentId}", "action='publishWire' AND itemid='{$itemid}' AND userid1=" . $db->ui->userid); } } else { $code = SIGNIN_LINK; }
<?php /* initialize database and libraries */ define("INIT_COMMON", true); define("INIT_PAGE", true); define("INIT_AJAX", true); define("INIT_SESSION", true); include_once 'initialize.php'; require_once PATH_PHP . 'classes/newswire.class.php'; $nwObj = new newswire($db); /* process request variables */ if (isset($_GET['currentPage'])) { $currentPage = $_GET['currentPage']; } else { $currentPage = 1; } /* begin building the page */ $page->setTitle('Newswire'); $page->pkgStyles(CACHE_PREFIX . 'nrNewswire', array(PATH_PHP_STYLES . '/paging.css', PATH_PHP_STYLES . '/newsroom.css', PATH_PHP_STYLES . '/tabs.css')); $page->pkgScripts(CACHE_PREFIX . 'nrNewswire', array(PATH_PHP_SCRIPTS . '/common.js', PATH_PHP_SCRIPTS . '/newswire.js', PATH_PHP_SCRIPTS . '/publishWire.js')); $page->addToHeader($common->buildHeader() . $common->buildNavigation('Newswire')); $page->addToFooter($common->buildFooter()); $page->addRSSFeed(URL_HOME . '?p=rss'); $code = ''; $code .= '<div id="pageBody">'; $code .= '<div id="pageContent"><div id="theFilter"></div>'; $code .= '<div id="storyList">'; $code .= $nwObj->fetchNewswirePage(0, $currentPage); $code .= '</div><!-- end storyList -->'; // $code.=$fb->buildDialog(); $code .= '</div><!-- end pageContent -->';
<?php /* initialize database and libraries */ define("INIT_COMMON", true); define("INIT_PAGE", true); define("INIT_AJAX", true); define("INIT_SESSION", true); include_once 'initialize.php'; require_once PATH_PHP . 'classes/newswire.class.php'; $nwObj = new newswire($db); /* begin building the page */ $page->setTitle('Blogs'); $page->pkgStyles(CACHE_PREFIX . 'nrNewswire', array(PATH_PHP_STYLES . '/paging.css', PATH_PHP_STYLES . '/newsroom.css', PATH_PHP_STYLES . '/tabs.css', PATH_PHP_STYLES . '/columns.css')); $page->pkgScripts(CACHE_PREFIX . 'nrNewswire', array(PATH_PHP_SCRIPTS . '/common.js', PATH_PHP_SCRIPTS . '/newswire.js', PATH_PHP_SCRIPTS . '/publishWire.js')); $page->addToHeader($common->buildHeader() . $common->buildNavigation('Blogs')); $page->addToFooter($common->buildFooter()); $page->addRSSFeed(URL_HOME . '?p=rss'); $code = ''; $code .= '<div id="pageBody">'; $code .= '<div id="pageContent"><div id="theFilter"></div>'; $code .= '<div id="storyList">'; // fetch the blog list // fetch stories from each blog $cols = $nwObj->fetchNewswireMatrix(); $code .= $common->equalCols(3, 'ecRow', 'col1', $cols[0], '', $cols[1], '', $cols[2]); $code .= '</div><!-- end storyList -->'; $code .= '</div><!-- end pageContent -->'; $code .= '</div><!-- end pageBody -->'; $page->addToContent($code); $page->display();