<?php if (!defined('VB_ENTRY')) die('Access denied.'); class vB_Library_VB4_Posthash extends vB_Library { public function getNewPosthash() { $random = new vB_Utility_Random(); return $random->nonsecureAlphanumeric(32); } private function getFiledataids($posthash) { $result = vB_dB_Assertor::instance()->getRows('vBMAPI:getPosthashFiledataids', array( 'posthash' => $posthash, )); return $result; } public function addFiledataid($posthash, $filedataid) { $result = vB_dB_Assertor::instance()->assertQuery('vBMAPI:insertPosthashFiledataid', array( 'posthash' => $posthash, 'filedataid' => $filedataid, 'dateline' => vB::getRequest()->getTimeNow(), )); return $result; } public function appendAttachments($nodeid, $posthash) { if (!empty($posthash) AND !empty($nodeid)) { $filedataids = vB_Library::instance('vb4_posthash')->getFiledataids($posthash); foreach ($filedataids as $filedataid) { $result = vB_Api::instance('node')->addAttachment($nodeid, array('filedataid' => $filedataid['filedataid'])); if (empty($result) || !empty($result['errors'])) { } } } } } 