/**
     * ShowContent
     * Check for PHP inside and output the content.
     */
    function pmxc_ShowContent()
    {
        global $context, $txt;
        // check for inside php code
        $havePHP = PortaMx_GetInsidePHP($this->cfg['content']);
        // remove or add highslide code
        if (!empty($this->cfg['config']['settings']['disableHSimg']) || !empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
            $this->cfg['content'] = preg_replace_callback('~<img.*class[^r]*resized[^>]*>~', create_function('$matches', 'return str_replace("resized", "", $matches[0]);'), $this->cfg['content']);
        } else {
            $this->cfg['content'] = pmx_addHighSlide($this->cfg['content']);
        }
        // Write out the content
        if (!empty($this->cfg['config']['settings']['printing'])) {
            $printdir = 'ltr';
            $printChars = $context['character_set'];
            echo '
			<img class="pmx_printimg" src="' . $context['pmx_imageurl'] . 'Print.png" alt="Print" title="' . $txt['pmx_text_printing'] . '" onclick="PmxPrintPage(\'' . $printdir . '\', \'' . $this->cfg['id'] . '\', \'' . $printChars . '\', \'' . $this->getUserTitle() . '\')" />
			<div id="print' . $this->cfg['id'] . '">';
        }
        if (!empty($havePHP)) {
            eval($this->cfg['content']);
        } else {
            echo $this->cfg['content'];
        }
        if (!empty($this->cfg['config']['settings']['printing'])) {
            echo '
			</div>';
        }
    }
예제 #2
0
    /**
     * ShowContent
     * Check for PHP inside, prepare the content and save in $this->cfg['content'].
     * Also check for tease the content.
     */
    function pmxc_ShowContent()
    {
        global $context, $scripturl, $txt;
        $printdir = 'ltr';
        $printChars = $context['character_set'];
        $this->cfg['content'] = '<div class="htmlblock">' . $this->cfg['content'] . '</div>';
        // remove or add highslide code
        if (!empty($this->cfg['config']['settings']['disableHSimg']) || !empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
            $this->cfg['content'] = preg_replace_callback('~<img.*class[^r]*resized[^>]*>~', create_function('$matches', 'return str_replace("resized", "", $matches[0]);'), $this->cfg['content']);
        } else {
            $this->cfg['content'] = pmx_addHighSlide($this->cfg['content']);
        }
        // check for tease
        if (!empty($this->cfg['config']['settings']['teaser']) && preg_match('/(<span|<div)\\s+style=\\"page-break-after\\:/is', $this->cfg['content']) > 0) {
            $statID = 'blk' . $this->cfg['id'];
            $tmp = '
				<div id="short_' . $statID . '">' . PortaMx_Tease_posts($this->cfg['content'], -1, '<div class="smalltext" style="text-align:right;"><a id="href_short_' . $statID . '" href="' . $scripturl . '" style="padding: 0 5px;" onclick="ShowHTML(\'' . $statID . '\')">' . $txt['pmx_readmore'] . '</a></div>') . '
				</div>';
            if (!empty($context['pmx']['is_teased'])) {
                $this->cfg['content'] = preg_replace('~<div style="page-break-after\\:(.*)<\\/div>~i', '', $this->cfg['content']);
                $this->cfg['content'] = '
				<div id="full_' . $statID . '" style="display:none;">' . (!empty($this->cfg['config']['settings']['printing']) ? '
					<img class="pmx_printimg" src="' . $context['pmx_imageurl'] . 'Print.png" alt="Print" title="' . $txt['pmx_text_printing'] . '" onclick="PmxPrintPage(\'' . $printdir . '\', \'' . $this->cfg['id'] . '\', \'' . $printChars . '\', \'' . $this->getUserTitle() . '\')" />
					<div id="print' . $this->cfg['id'] . '">' . $this->cfg['content'] . '
					</div>' : $this->cfg['content']) . '
					<div class="smalltext" style="text-align:right;">
						<a id="href_full_' . $statID . '" href="' . $scripturl . '" style="padding: 0 5px;;" onclick="ShowHTML(\'' . $statID . '\')">' . $txt['pmx_readclose'] . '</a>
					</div>
				</div>' . $tmp;
                unset($tmp);
            }
        }
        if (empty($context['pmx']['is_teased']) && !empty($this->cfg['config']['settings']['printing'])) {
            $this->cfg['content'] = '
			<img class="pmx_printimg" src="' . $context['pmx_imageurl'] . 'Print.png" alt="Print" title="' . $txt['pmx_text_printing'] . '" onclick="PmxPrintPage(\'' . $printdir . '\', \'' . $this->cfg['id'] . '\', \'' . $printChars . '\', \'' . $this->getUserTitle() . '\')" />
			<div id="print' . $this->cfg['id'] . '">' . preg_replace('~<div style="page-break-after\\:(.*)<\\/div>~i', '', $this->cfg['content']) . '
			</div>';
        }
        // check for inside php code and write out the content
        if (PortaMx_GetInsidePHP($this->cfg['content'])) {
            eval($this->cfg['content']);
        } else {
            echo $this->cfg['content'];
        }
    }
    /**
     * Write out the Content
     */
    function WriteContent($article)
    {
        global $context, $scripturl, $txt;
        $printdir = 'ltr';
        $printID = 'art' . $article['id'];
        $printChars = $context['character_set'];
        $statID = 'art' . $article['id'] . $this->cfg['side'];
        $tease = 0;
        $phpcount = 0;
        if ($article['ctype'] == 'php') {
            // Check we have a show part
            if (preg_match('~\\[\\?pmx_showphp(.*)pmx_showphp\\?\\]~is', $article['content'], $match)) {
                $article['content'] = $match[1];
                $phpcount = 1;
            }
        } else {
            if ($article['ctype'] == 'bbc_script') {
                $article['content'] = PortaMx_BBCsmileys(parse_bbc($article['content'], false));
                $tease = $article['config']['settings']['teaser'];
            } elseif ($article['ctype'] == 'html') {
                $article['content'] = '<div class="htmlblock">' . $article['content'] . '</div>';
                $tease = !empty($article['config']['settings']['teaser']) ? -1 : 0;
            } else {
                $tease = $article['config']['settings']['teaser'];
            }
            // remove or add highslide code
            if (!empty($article['config']['settings']['disableHSimg']) || !empty($context['pmx']['settings']['disableHS']) || !empty($context['pmx']['settings']['disableHSonfront'])) {
                $article['content'] = preg_replace_callback('~<img.*class[^r]*resized[^>]*>~', create_function('$matches', 'return str_replace("resized", "", $matches[0]);'), $article['content']);
            } else {
                $article['content'] = pmx_addHighSlide($article['content']);
            }
        }
        // article teaser set?
        if (!empty($tease)) {
            $tmp = '
								<div id="short_' . $statID . '">
								' . PortaMx_Tease_posts($article['content'], $tease, '<div class="smalltext" style="text-align:right;"><a id="href_short_' . $statID . '" href="' . $scripturl . '" style="padding: 0 5px;" onclick="ShowHTML(\'' . $statID . '\')">' . $txt['pmx_readmore'] . '</a></div>') . '
								</div>';
            // if teased?
            if (!empty($context['pmx']['is_teased'])) {
                $article['content'] = preg_replace('~<div style="page-break-after\\:(.*)<\\/div>~i', '', $article['content']);
                $article['content'] = '' . (!empty($article['config']['settings']['printing']) ? '
								<div id="full_' . $statID . '" style="display:none;">
									<img class="pmx_printimg" src="' . $context['pmx_imageurl'] . 'Print.png" alt="Print" title="' . $txt['pmx_text_printing'] . '" onclick="PmxPrintPage(\'' . $printdir . '\', \'' . $printID . '\', \'' . $printChars . '\', \'' . $this->getUserTitle($article, $article['name']) . '\')" />
									<div id="print' . $printID . '">' . $article['content'] . '
									</div>
									<div class="smalltext" style="text-align:right;">
										<a id="href_full_' . $statID . '" href="' . $scripturl . '" style="padding: 0 5px;" onclick="ShowHTML(\'' . $statID . '\')">' . $txt['pmx_readclose'] . '</a>
									</div>
								</div>' : '
								<div id="full_' . $statID . '" style="display:none;">' . $article['content'] . '
									<div class="smalltext" style="text-align:right;">
										<a id="href_full_' . $statID . '" href="' . $scripturl . '" style="padding: 0 5px;" onclick="ShowHTML(\'' . $statID . '\')">' . $txt['pmx_readclose'] . '</a>
									</div>
								</div>') . $tmp;
            }
            unset($tmp);
        } elseif (!empty($article['config']['settings']['printing'])) {
            $article['content'] = '
								<img class="pmx_printimg" src="' . $context['pmx_imageurl'] . 'Print.png" alt="Print" title="' . $txt['pmx_text_printing'] . '" onclick="PmxPrintPage(\'' . $printdir . '\', \'' . $this->cfg['id'] . '\', \'' . $printChars . '\', \'' . $this->getUserTitle($article, $article['name']) . '\')" />
								<div id="print' . $this->cfg['id'] . '">' . preg_replace('~<div style="page-break-after\\:(.*)<\\/div>~i', '', $article['content']) . '
								</div>';
        }
        // check for inside php code
        if ($article['ctype'] == 'html' || $article['ctype'] == 'script') {
            $havePHP = PortaMx_GetInsidePHP($article['content']);
        }
        if (!empty($havePHP)) {
            eval($article['content']);
        } else {
            echo $article['content'];
        }
        if (!empty($article['config']['settings']['showfooter'])) {
            echo '
							<div style="clear:both;min-height:20px;margin-top:7px;"><hr class="pmx_hr" />
								<div class="smalltext" style="float:left;">
									' . $txt['pmx_text_createdby'] . (!empty($article['member_name']) ? '<a href="' . $scripturl . '?action=profile;u=' . $article['owner'] . '">' . $article['member_name'] . '</a>' : $txt['pmx_user_unknown']) . ', ' . timeformat($article['created']) . '
								</div>';
            if (!empty($article['updated'])) {
                echo '
								<div class="smalltext" style="float:right;">
									' . $txt['pmx_text_updated'] . timeformat($article['updated']) . '
								</div>';
            }
            echo '
							</div>';
        }
    }