protected function buildOutputFromItems($items, $options) { $output = $this->threadObj; $output .= "var threads = new Array(" . sizeof($items) . ");\r\n"; $itemnum = 0; $items = $this->formatItems($items, $options); foreach ($items as $item) { $item = $item['content']; $item['title'] = vB_Library_Functions::addSlashesJs(vB_String::htmlSpecialCharsUni($item['external_prefix_plain']) . $item['external_title']); $item['authorname'] = vB_Library_Functions::addSlashesJs($item['authorname']); $output .= "\tthreads[{$itemnum}] = new thread({$item['external_nodeid']}, '{$item['title']}', '{$item['authorname']}', '" . vB_Library_Functions::addSlashesJs($this->callvBDate(vB::getDatastore()->getOption('dateformat'), $item['publishdate'])) . "', '" . vB_Library_Functions::addSlashesJs($this->callvBDate(vB::getDatastore()->getOption('timeformat'), $item['publishdate'])) . "');\r\n"; $itemnum++; } return $output; }
protected function verifyAttachmentPath($userid) { // Allow userid to be 0 since vB2 allowed guests to post attachments $userid = intval($userid); $path = $this->fetchAttachmentPath($userid); if (vB_Library_Functions::vbMkdir($path)) { return $path; } else { return false; } }
/** * Get the path for a user and make sure it exists * * @param int $userid * @param int Attachment storage type to use to generate the path * * @return string path to user's storage. */ public function fetchAttachmentPath($userid, $storageType) { // Allow userid to be 0 since vB2 allowed guests to post attachments $userid = intval($userid); if (empty($attachPath)) { $attachPath = $this->filePath; } if ($storageType == self::ATTACH_AS_FILES_NEW) { $path = $attachPath . '/' . implode('/', preg_split('//', $userid, -1, PREG_SPLIT_NO_EMPTY)); } else { $path = $attachPath . '/' . $userid; } if (is_dir($path)) { return $path; } else { if (file_exists($path)) { throw new vB_Exception_Api('attachpathfailed'); } } if (vB_Library_Functions::vbMkdir($path)) { return $path; } else { return false; } }
/** Check if product is installed and install if option is set. * **/ private static function autoInstall($product, $class, $xmlDir = '', $products) { if ($class->AutoInstall and !isset($products[$product])) { vB_Library_Functions::installProduct($product, $xmlDir); } }