Beispiel #1
0
/**
 * @param string $destDiv
 * @param int $inStart
 * @param bool $inReload
 */
function refreshWebmail($destDiv = 'mod-webmail_inbox', $inStart = 0, $inReload = false)
{
    global $user, $prefs, $module_params;
    $smarty = TikiLib::lib('smarty');
    if (isset($_SESSION['webmailinbox'][$destDiv]['module_params'])) {
        $module_params = $_SESSION['webmailinbox'][$destDiv]['module_params'];
    } else {
        $module_params = array();
        // TODO error?
    }
    if ($inReload) {
        $module_params['reload'] = 'y';
    }
    $module_params['nobox'] = 'y';
    $module_params['notitle'] = 'y';
    $module_params['np'] = '0';
    $module_params['module'] = 'webmail_inbox';
    if ($inStart > 0) {
        $_SESSION['webmailinbox'][$destDiv]['start'] = $inStart;
    }
    include 'lib/wiki-plugins/wikiplugin_module.php';
    $data = wikiplugin_module('', $module_params);
    //	$objResponse = new xajaxResponse();
    //	$objResponse->script('setTimeout("initWebmail()",1000)');
    //
    //	$objResponse->assign($destDiv,"innerHTML",$data);
    //	return $objResponse;
}
function processShout($formValues, $destDiv = 'mod-shoutbox')
{	// AJAX_TODO
	global $shoutboxlib, $user, $smarty, $prefs, $tiki_p_admin_shoutbox;
	$smarty->assign('tweet', $formValues['tweet']);
	$smarty->assign('facebook', $formValues['facebook']);
	if (array_key_exists('shout_msg', $formValues) && strlen($formValues['shout_msg']) > 2) {
		if (empty($user) && $prefs['feature_antibot'] == 'y' && !$captchalib->validate()) {
			$smarty->assign('shout_error', $captchalib->getErrors());
			$smarty->assign_by_ref('shout_msg', $formValues['shout_msg']);
		} else {
			$shoutboxlib->replace_shoutbox(0, $user, $formValues['shout_msg'], ($formValues['shout_tweet']==1), ($formValues['shout_facebook']==1));
		}
	} else if (array_key_exists('shout_remove', $formValues) && $formValues['shout_remove'] > 0) {
		$info = $shoutboxlib->get_shoutbox($formValues['shout_remove']);
		if ($tiki_p_admin_shoutbox == 'y' || $info['user'] == $user) {
			$shoutboxlib->remove_shoutbox($formValues['shout_remove']);
		}
	}
	//$ajaxlib->registerTemplate('mod-shoutbox.tpl');
	include ('lib/wiki-plugins/wikiplugin_module.php');
	$data = wikiplugin_module('', Array('module' => 'shoutbox', 'max' => 10, 'np' => 0, 'nobox' => 'y', 'notitle' => 'y', 'tweet'=>$formValues['tweet']));
	//$objResponse->assign($destDiv, "innerHTML", $data);
	//return $objResponse;
}