function activities_ajax_submit_handler()
{
    header('Content-Type: text/xml');
    //	header('HTTP/1.0 200 Ok');
    header("Cache-Control: no-cache, must-revalidate");
    // HTTP/1.1
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    $response = '<' . '?xml version="1.0" encoding="' . get_charset() . '" ?' . '>';
    $response .= '<response><content>';
    $map = array();
    $guest_id = intval($GLOBALS['FORUM_DRIVER']->get_guest_id());
    if (!is_guest(get_member())) {
        $map['STATUS'] = trim(either_param('status', ''));
        if (post_param('zone', '') != '' && $map['STATUS'] != '' && $map['STATUS'] != do_lang('activities:TYPE_HERE')) {
            comcode_to_tempcode($map['STATUS'], $guest_id, false, NULL);
            $map['PRIVACY'] = either_param('privacy', 'private');
            if (strlen(strip_tags($map['STATUS'])) < strlen($map['STATUS'])) {
                $cc_guide = build_url(array('page' => 'userguide_comcode'), 'site');
                $response .= '<success>0</success><feedback><![CDATA[No HTML allowed. See <a href="' . $cc_guide->evaluate() . '">Comcode Help</a> for info on the alternative.]]></feedback>';
            } else {
                if (strlen($map['STATUS']) > 255) {
                    $response .= '<success>0</success><feedback>Message is ' . strval(strlen($map['STATUS']) - 255) . ' characters too long</feedback>';
                } else {
                    $stored_id = activities_addon_syndicate_described_activity('RAW_DUMP', $map['STATUS'], '', '', '', '', '', '', $map['PRIVACY'] == 'public' ? 1 : 0);
                    if ($stored_id > 0) {
                        $response .= '<success>1</success><feedback>Message received.</feedback>';
                    } elseif ($stored_id == -1) {
                        $response .= '<success>0</success><feedback>Message already received.</feedback>';
                    }
                }
            }
        }
    } else {
        $response .= '<success>0</success><feedback>' . do_lang('LOGIN_EXPIRED_POST') . '</feedback>';
    }
    $response .= '</content></response>';
    echo $response;
}
Example #2
0
 /**
  * Syndicate human-intended descriptions of activities performed to the internal wall, and external listeners.
  *
  * @param  string			Language string code
  * @param  string			Label 1 (given as a parameter to the language string code)
  * @param  string			Label 2 (given as a parameter to the language string code)
  * @param  string			Label 3 (given as a parameter to the language string code)
  * @param  string			Page link 1
  * @param  string			Page link 2
  * @param  string			Page link 3
  * @param  string			Addon that caused the event
  * @param  BINARY			Whether this post should be public or friends-only
  * @param  ?MEMBER		Member being written for (NULL: current member)
  * @param  boolean		Whether to push this out as a site event if user requested
  * @param  ?MEMBER		Member also 'intimately' involved, such as a content submitter who is a friend (NULL: none)
  * @return ?AUTO_LINK	ID of the row in the activities table (NULL: N/A)
  */
 function syndicate_described_activity($a_language_string_code = '', $a_label_1 = '', $a_label_2 = '', $a_label_3 = '', $a_pagelink_1 = '', $a_pagelink_2 = '', $a_pagelink_3 = '', $a_addon = '', $a_is_public = 1, $a_member_id = NULL, $sitewide_too = false, $also_involving = NULL)
 {
     require_code('activities_submission');
     return activities_addon_syndicate_described_activity($a_language_string_code, $a_label_1, $a_label_2, $a_label_3, $a_pagelink_1, $a_pagelink_2, $a_pagelink_3, $a_addon, $a_is_public, $a_member_id, $sitewide_too, $also_involving);
 }