/** * Adds content info to $result so that merged content can be edited. * @param array $result * @param array $content */ public function mergeContentInfo(&$result, $content) { parent::mergeContentInfo($result, $content); if (!isset($content['items'])) { throw new vB_Exception_Api('invalid_content_info'); } foreach ($content['items'] as $video) { $result['items'][] = $video; } }
public function getIndexableFromNode($content, $include_attachments = true) { $indexableContent = parent::getIndexableFromNode($content, $include_attachments); if (empty($content['note'])) { $indexableContent['note'] = $content['note']; } if (empty($content['actionreason'])) { $indexableContent['actionreason'] = $content['actionreason']; } if (empty($content['customreason'])) { $indexableContent['customreason'] = $content['customreason']; } return $indexableContent; }
/** This cleans up for a node that was found to be incomplete by deleting the child nodes and subsidiary table records * @param mixed node record, which may have missing child table data. */ public function incompleteNodeCleanup($node) { $deleted = parent::incompleteNodeCleanup($node); if ($deleted) { //The poll, text, and node records will be deleted by the parent. We need to delete polloption and pollvote; $params = array(vB_db_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $node['nodeid']); //delete polloptions $this->assertor->assertQuery('vBForum:polloption', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $node['nodeid'])); //delete pollvotes $this->assertor->assertQuery('vBForum:pollvote', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $node['nodeid'])); } return $deleted; }
/** This cleans up for a node that was found to be incomplete by deleting the child nodes and subsidiary table records * @param mixed node record, which may have missing child table data. */ public function incompleteNodeCleanup($node) { $deleted = parent::incompleteNodeCleanup($node); if ($deleted) { //The text and privatemessage records will be deleted by the parent. We need to delete the sentto records. $this->assertor->assertQuery('vBForum:sentto', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_DELETE, 'nodeid' => $node['nodeid'])); } return $deleted; }
public function getFullContent($nodes, $permissions = false) { if (empty($nodes)) { return array(); } $results = parent::getFullContent($nodes, $permissions); // collect all destiny nodeids and store a reference results foreach ($results as $nodeid => $node) { $redirect[$node['tonodeid']] =& $results[$nodeid]; } if (!empty($redirect)) { // fetch destiny nodes info $destiny = vB_Library::instance('node')->getFullContentForNodes(array_keys($redirect)); foreach ($destiny as $d) { // this modifies $result $redirect[$d['nodeid']]['toNode'] = $d; } } return $results; }
public function getFullContent($nodeid, $permissions = false) { if (empty($nodeid)) { return array(); } $results = parent::getFullContent($nodeid, $permissions); $reportparentnode = array(); foreach ($results as $key => $result) { try { $reportnode = $this->nodeApi->getNodeFullContent($results[$key]['reportnodeid']); } catch (vB_Exception_NodePermission $e) { $results[$key]['node_no_permission'] = true; continue; } catch (vB_Exception_Api $e) { // The node probably does not exist. $results[$key]['reportnodeid'] = NULL; $results[$key]['reportnodetype'] = NULL; $results[$key]['reportparentnode'] = NULL; $results[$key]['reportnodetitle'] = NULL; $results[$key]['reportnoderouteid'] = NULL; continue; } if ($reportnode[$results[$key]['reportnodeid']]['nodeid'] == $reportnode[$results[$key]['reportnodeid']]['starter']) { $results[$key]['reportnodetype'] = 'starter'; } elseif ($reportnode[$results[$key]['reportnodeid']]['parentid'] == $reportnode[$results[$key]['reportnodeid']]['starter']) { $results[$key]['reportnodetype'] = 'reply'; //fetch parent info of reply (starter) $parentid = $reportnode[$results[$key]['reportnodeid']]['parentid']; if (!isset($reportparentnode[$parentid])) { $reportparentnode[$parentid] = $this->nodeApi->getNodeFullContent($parentid); $reportparentnode[$parentid] = $reportparentnode[$parentid][$parentid]; } $results[$key]['reportparentnode'] = $reportparentnode[$parentid]; } else { $results[$key]['reportnodetype'] = 'comment'; //fetch parent info of comment (reply) $parentid = $reportnode[$results[$key]['reportnodeid']]['parentid']; if (!isset($reportparentnode[$parentid])) { $reportparentnode[$parentid] = $this->nodeApi->getNodeFullContent($parentid); $reportparentnode[$parentid] = $reportparentnode[$parentid][$parentid]; } $results[$key]['reportparentnode'] = $reportparentnode[$parentid]; } $results[$key]['reportnodetitle'] = $reportnode[$results[$key]['reportnodeid']]['title']; $results[$key]['reportnoderouteid'] = $reportnode[$results[$key]['reportnodeid']]['routeid']; } return $results; }
/** This function either deletes the gallery if it has no photos, or fixes it. * @param mixed node record, which may have missing child table data. */ public function incompleteNodeCleanup($node) { //If we have child records we should create whatever records we missed. $children = $this->assertor->assertQuery('vBForum:node', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'parentid' => $node['nodeid'])); if ($children->valid()) { //We need to make sure we have text and gallery records. foreach ((array) $this->tablename as $table) { $tableCheck = $this->assertor->assertQuery('vBForum:' . $table, array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, 'nodeid' => $node['nodeid'])); if (!$tableCheck->valid()) { $this->assertor->assertQuery('vBForum:' . $table, array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_INSERT, 'nodeid' => $node['nodeid'])); } } vB_Cache::instance()->allCacheEvent(array('nodeChg_' . $node['parentid'], 'nodeChg_' . $node['nodeid'])); vB_Library::instance('node')->clearCacheEvents($node['nodeid']); } else { //Just do the delete, which is handled in the parent classes parent::incompleteNodeCleanup($node); } }
public function getQuotes($nodeids) { //Per Product, we just quote the text content (but this may change in the future) //If and when the requirement changes to include the non-text content, don't call the parent method and then implement it here return parent::getQuotes($nodeids); }