/** * Used by getSignatureInfo and parseSignatures to parse a signature * * @param int User ID * @param string|false (Optional) Signature text or false if unknown * @param bool (Optional) Flag to control skipping the dupe check or not. * * @return array Array containing the parsed signature: * <pre> * array( * signature => parsed signature * allowed => array of bbcode tags the user is allowed to use in their signature * disabled => array of bbcode tags the user is NOT allowed to use in their signature * ) * </pre> */ protected function doParseSignature($userid, $signature = false, $skipdupcheck = false) { if (empty($signature)) { $sigInfo = vB_Api::instanceInternal('user')->fetchSignature($userid); if (empty($sigInfo) or empty($sigInfo['raw'])) { $sigInfo['raw'] = ''; } $signature = $sigInfo['raw']; } require_once DIR . '/includes/class_sigparser.php'; $sig_parser = new vB_SignatureParser(vB::get_registry(), $this->fetchTagList(), $userid); $sig_parser->setSkipdupcheck($skipdupcheck); // Parse the signature $parsed = $sig_parser->parse($signature); $perms = $sig_parser->getPerms(); //only cache the parsed signature if it came from the DB if (isset($sigInfo)) { $cacheKey = "vbSig_{$userid}"; $cachePermKey = "vbSigPerm_{$userid}"; $cache = vB_Cache::instance(vB_Cache::CACHE_STD); $cache->write($cacheKey, $parsed, 1440, "userChg_{$userid}"); $cache->write($cachePermKey, $perms, 1440, "userChg_{$userid}"); } return array('signature' => $parsed, 'allowed' => $perms['can'], 'disabled' => $perms['cant']); }