Exemplo n.º 1
0
/**
 * Output the trackback script and handle trackbacks.
 */
function trackback_script()
{
    if (get_option('is_on_trackbacks') == '0') {
        return;
    }
    require_lang('trackbacks');
    header('Content-type: text/xml');
    $page = get_param('page');
    $id = get_param_integer('id');
    $mode = either_param('__mode', 'none');
    $allow_trackbacks = true;
    $hooks = find_all_hooks('systems', 'trackback');
    foreach (array_keys($hooks) as $hook) {
        if ($hook == $page) {
            require_code('hooks/systems/trackback/' . filter_naughty_harsh($hook));
            $object = object_factory('Hook_trackback_' . filter_naughty_harsh($hook), true);
            if (is_null($object)) {
                continue;
            }
            $allow_trackbacks = $object->run($id);
            break;
        }
    }
    if ($mode == 'rss') {
        //List all the trackbacks to the specified page
        $xml = get_trackbacks($page, strval($id), $allow_trackbacks, 'xml');
    } else {
        $time = get_param_integer('time');
        if ($time > time() - 60 * 5) {
            exit;
        }
        // Trackback link intentionally goes stale after 5 minutes, so it can't be statically stored and spam hammered
        //Add a trackback for the specified page
        $output = actualise_post_trackback($allow_trackbacks, $page, strval($id));
        if ($output) {
            $xml = do_template('TRACKBACK_XML_NO_ERROR', array());
        } else {
            $xml = do_template('TRACKBACK_XML_ERROR', array('_GUID' => 'ac5e34aeabf92712607e62e062407861', 'TRACKBACK_ERROR' => do_lang_tempcode('TRACKBACK_ERROR')));
        }
    }
    $echo = do_template('TRACKBACK_XML_WRAPPER', array('_GUID' => 'cd8d057328569803a6cca9f8d37a0ac8', 'XML' => $xml));
    $echo->evaluate_echo();
}
Exemplo n.º 2
0
 /**
  * Standard modular run function.
  *
  * @param  array		A map of parameters.
  * @return tempcode	The result of execution.
  */
 function run($map)
 {
     if (!array_key_exists('page', $map)) {
         $map['page'] = get_page_name();
     }
     if (array_key_exists('id', $map)) {
         $id = $map['id'];
     } else {
         $id = get_param('id', '0');
     }
     require_code('feedback');
     //$self_url=get_self_url();
     //$self_title=$map['page'];
     /*$test_changed=post_param('title','');
     		if ($test_changed!='')
     		{
     			decache('main_trackbacks');
     		}*/
     //actualise_post_trackbacks(1,'block_main_trackbacks',$map['page'].'_'.$map['param'].$extra,$self_url,$self_title);
     actualise_post_trackback(get_option('is_on_trackbacks') == '1', $map['page'], $id);
     return get_trackbacks($map['page'], $id, get_option('is_on_trackbacks') == '1');
 }