Example #1
0
/*while (ob_get_level ()) {
	ob_end_clean ();
}
ob_implicit_flush ();*/
loader_import('xed.Cleaners');
if (!empty($parameters['data'])) {
    $original = $parameters['data'];
    $parameters['data'] = the_cleaners($parameters['data']);
} else {
    $original = '';
}
if (!empty($parameters['ifname'])) {
    // called as an rpc service, return the cleaned data via saf.Misc.RPC
    //loader_import ('saf.Misc.RPC');
    //echo rpc_response ($parameters['ifname'], $parameters['data']);
    $parameters['data'] = the_cleaners($parameters[$parameters['ifname']]);
    $parameters['data'] = preg_replace("/(\r\n|\n\r|\r|\n)/", "'\n\t\t+ '\\n", addslashes($parameters['data']));
    $parameters['data'] = str_replace('</script>', '</\' + \'script>', $parameters['data']);
    page_template('dialog');
    page_title(intl_get('Document has been cleaned.'));
    page_add_script(template_simple('clean_reply.spt', $parameters));
    echo '<p><a href="#" onclick="window.close ()">' . intl_get('Close Window') . '</a></p>';
    return;
} elseif ($parameters['ws'] == 'true') {
    // called as a web service, return the cleaned data only
    echo $parameters['data'];
    exit;
}
echo '<h1>Cleaners Test</h1>
<form method="post">
<p>Please enter some HTML to clean:</p>
Example #2
0
 function cleaners($ifname, $data)
 {
     loader_import('xed.Cleaners');
     return array($ifname, the_cleaners($data));
 }
Example #3
0
<?php

loader_import('xed.Cleaners');
global $cgi;
$cgi->html = the_cleaners($cgi->html);
page_add_style(site_prefix() . '/js/prompt.css');
page_add_script(site_prefix() . '/js/prototype.js');
page_add_script(site_prefix() . '/js/scriptaculous/scriptaculous.js');
page_add_script(site_prefix() . '/js/prompt.js');
class XedSourceForm extends MailForm
{
    function XedSourceForm()
    {
        parent::MailForm();
        $this->parseSettings('inc/app/xed/forms/source/settings.php');
        $this->ifname = $GLOBALS['cgi']->ifname;
    }
    function onSubmit($vals)
    {
        $i = $vals['ifname'];
        $html = str_replace(array("'", "\r", "\n"), array('\\\'', '\\r', '\\n'), $vals['html']);
        unset($vals['ifname']);
        unset($vals['submit_button']);
        header('Content-Type: text/html; charset=' . intl_charset());
        echo template_simple('source_return.spt', array('ifname' => $i, 'html' => $html));
        exit;
    }
}
Example #4
0
 function getValue($cgi = '')
 {
     if (!is_object($cgi)) {
         if (!isset($this->data_value)) {
             $value = $this->default_value;
         } else {
             $value = $this->data_value;
         }
     } else {
         if (isset($cgi->{$this->name})) {
             $value = $cgi->{$this->name};
         } else {
             $value = '';
         }
     }
     if ($this->clean) {
         loader_import('xed.Cleaners');
         if ($this->tidy_path) {
             $GLOBALS['TIDY_PATH'] = $this->tidy_path;
         }
         $value = the_cleaners($value, true, $this->safe);
     }
     // remove any stylesheet links
     $value = preg_replace('/<link[^>]+>[\\r\\n\\t ]*/is', '', $value);
     return $value;
 }