{
parent::Horde_Form($vars, _("New Paste"));
- $types = array('none', 'php');
+ $engine = 'Pastie_Highlighter_' . $GLOBALS['conf']['highlighter']['engine'];
+ $tmp = call_user_func(array($engine, 'getSyntaxes'));
+ $types = array();
+ foreach ($tmp as $type) {
+ $types[$type] = $type;
+ }
+
+ // Some highlighters have a long list of supported languages.
+ // Default to PHP if one is not already specified
+ $curtype = $vars->get('syntax');
+ if (empty($curtype)) {
+ $vars->set('syntax', 'php');
+ }
$this->addVariable(_("Title"), 'title', 'text', false);
$notification->push(sprintf('Paste saved. %s', $uuid), 'horde.success');
- $url = Horde::applicationUrl('view/' . $uuid, true);
+ $url = Horde::applicationUrl('uuid/' . $uuid, true);
header('Location: ' . $url);
exit;
} catch (Exception $e) {
$pastie = Horde_Registry::appInit('pastie');
require_once PASTIE_BASE . '/lib/Forms/Paste.php';
-$uuid = trim(Horde_Util::getPathInfo(), '/');
+$uuid = Horde_Util::getFormData('uuid');
if (!empty($uuid)) {
try {
try {
$engine = 'Pastie_Highlighter_' . $GLOBALS['conf']['highlighter']['engine'];
- $output = $engine::output($paste['paste'], $paste['syntax']);
+ $output = call_user_func_array(array($engine, 'output'), array($paste['paste'], $paste['syntax']));
} catch (Pastie_Exception $e) {
$output = _("Error parsing the paste.");
}