/** ----------------------------------- /** Parse Forms that Cannot Be Cached /** -----------------------------------*/ function parse_nocache($str) { global $FNS; if (!stristr($str, '{NOCACHE')) { return $str; } /** ----------------------------------- /** Generate Comment Form if needed /** -----------------------------------*/ // In order for the comment form not to cache the "save info" // data we need to generate dynamically if necessary if (preg_match_all("#{NOCACHE_(\\S+)_FORM=\"(.*?)\"}(.+?){/NOCACHE_FORM}#s", $str, $match)) { for ($i = 0, $s = sizeof($match['0']); $i < $s; $i++) { $class = $FNS->filename_security(strtolower($match['1'][$i])); if (!class_exists($class)) { require PATH_MOD . $class . '/mod.' . $class . EXT; } $this->tagdata = $match['3'][$i]; $vars = $FNS->assign_variables($match['3'][$i], '/'); $this->var_single = $vars['var_single']; $this->var_pair = $vars['var_pair']; $this->tagparams = $FNS->assign_parameters($match['2'][$i]); $this->var_cond = $FNS->assign_conditional_variables($match['3'][$i], '/', LD, RD); // Assign sites for the tag $this->_fetch_site_ids(); if ($class == 'gallery') { $str = str_replace($match['0'][$i], Gallery::comment_form(TRUE, $FNS->cached_captcha), $str); } elseif ($class == 'comment') { $str = str_replace($match['0'][$i], Comment::form(TRUE, $FNS->cached_captcha), $str); } $str = str_replace('{PREVIEW_TEMPLATE}', $match['2'][$i], $str); } } /** ----------------------------------- /** Generate Stand-alone Publish form /** -----------------------------------*/ if (preg_match_all("#{{NOCACHE_WEBLOG_FORM(.*?)}}(.+?){{/NOCACHE_FORM}}#s", $str, $match)) { for ($i = 0, $s = sizeof($match['0']); $i < $s; $i++) { if (!class_exists('Weblog')) { require PATH_MOD . 'weblog/mod.weblog' . EXT; } $this->tagdata = $match['2'][$i]; $vars = $FNS->assign_variables($match['2'][$i], '/'); $this->var_single = $vars['var_single']; $this->var_pair = $vars['var_pair']; $this->tagparams = $FNS->assign_parameters($match['1'][$i]); // Assign sites for the tag $this->_fetch_site_ids(); $XX = new Weblog(); $str = str_replace($match['0'][$i], $XX->entry_form(TRUE, $FNS->cached_captcha), $str); $str = str_replace('{PREVIEW_TEMPLATE}', isset($_POST['PRV']) ? $_POST['PRV'] : $this->fetch_param('preview'), $str); } } /** ----------------------------------- /** Generate Trackback hash if needed /** -----------------------------------*/ if (preg_match("#{NOCACHE_TRACKBACK_HASH}#s", $str, $match)) { if (!class_exists('Trackback')) { require PATH_MOD . 'trackback/mod.trackback' . EXT; } $str = str_replace($match['0'], Trackback::url(TRUE, $FNS->random('alpha', 8)), $str); } return $str; }