1<?php
2/*
3* e107 website system
4*
5* Copyright (c) 2008-2009 e107 Inc (e107.org)
6* Released under the terms and conditions of the
7* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
8*
9* Call Shortcodes via AJAX request
10*
11* $Source: /cvs_backup/e107_0.8/e107_files/e_ajax.php,v $
12* $Revision$
13* $Date$
14* $Author$
15*
16*/
17$_E107['minimal'] = TRUE;
18require_once("../class2.php");
19//ob_start();
20ob_implicit_flush(0);
21
22	// Ajax Short-code-Replacer Routine.
23
24	$shortcodes = "";
25	// FIXME - new .php shortcodes & security (require_once)
26	if($_POST['ajax_sc'] && $_POST['ajax_scfile'])
27	{
28		//include_once(e_HANDLER.'shortcode_handler.php');
29	 	$file = e107::getParser()->replaceConstants($_POST['ajax_scfile']);
30		$shortcodes = e107::getScParser()->parse_scbatch($file);
31	}
32
33	if(vartrue($_POST['ajax_sc']) && e_AJAX_REQUEST)
34	{
35		// temporary fix
36		global $register_sc;
37		if(isset($register_sc) && is_array($register_sc)) // Fix for missing THEME shortcodes.
38		{
39			 // parse errror fix from the previous commit
40			 e107::getScParser()->loadThemeShortcodes();
41		}
42		list($fld,$parm) = explode("=", $_POST['ajax_sc'], 2);
43		$prm = ($parm) ? "=".rawurldecode($parm) : ""; //var_dump($_GET);
44		echo e107::getParser()->parseTemplate("{".strtoupper($fld).$prm."}", true, $shortcodes);
45		exit;
46	}
47?>