Exemplo n.º 1
0
function uddeIMeditAutoresponder($option, $task, $act, $config) {
	$database = uddeIMgetDatabase();
	$emnid = intval( uddeIMmosGetParam( $_POST, 'id', '' ) );

	$sql="SELECT userid FROM #__uddeim_emn WHERE id=".(int)$emnid;
	$database->setQuery($sql);
	$userid = (int)$database->loadResult();

	$name = "unknown";
	$username = "******";
	$sql="SELECT name, username FROM #__users WHERE id=".(int)$userid;
	$database->setQuery($sql);
	$results = $database->loadObjectList();
	foreach($results as $result) {
		$username = $result->username;
		$name     = $result->name;
	}
//	$value = NULL;
//	if($database->loadObject($value)) {
//		$name = $value->username;
//		$email = $value->name;
//	}

	$emptysettings='';
	$emn_responder_checkstatus='';

	$sql="SELECT autoresponder FROM #__uddeim_emn WHERE id=".(int)$emnid;
	$database->setQuery($sql);
	$ison = (int)$database->loadResult();

	if ($ison==1) {
		$emn_responder_checkstatus='checked="checked"';
	}

	$sql="SELECT autorespondertext FROM #__uddeim_emn WHERE id=".(int)$emnid;
	$database->setQuery($sql);
	$autorespondertext = $database->loadResult();
	$autorespondertext = stripslashes($autorespondertext);
	if (!$autorespondertext) {
		$autorespondertext = _UDDEIM_AUTORESPONDER_DEFAULT;
	}
	if ($config->maxlength>0)		// because if 0 do not use any maxlength
		$autorespondertext = uddeIM_utf8_substr($config->languagecharset, $autorespondertext, 0, $config->maxlength);

	echo "<h4 style='text-align:left;'>"._UDDEIM_AUTORESPONDER.": ".$name." (".$username.")</h4>";
	echo "<p style='text-align:left;'>"._UDDEIM_AUTORESPONDER_EXP."</p>";
	echo "<form name='adminForm' id='adminForm' method='post' action='".uddeIMredirectIndex()."' class='adminForm' style='text-align:left;'>";
	echo '<input onclick="document.adminForm.autorespondercheck.checked ? document.adminForm.autorespondertext.disabled=false : document.adminForm.autorespondertext.disabled=true;" type="checkbox" '.$emn_responder_checkstatus.' value="1" name="autorespondercheck" />'._UDDEIM_EMN_AUTORESPONDER.'<br />';
	echo "<textarea name='autorespondertext' class='inputbox' rows='4' cols='60'".($ison==1 ? '' : 'disabled="disabled"').">".htmlentities($autorespondertext,ENT_QUOTES, $config->charset)."</textarea><br />";
	// echo '<input type="submit" name="reply" class="button" value="'._UDDEIM_SAVECHANGE.'" />';
	echo '<input type="hidden" name="option" value="'.$option.'" />';
	echo '<input type="hidden" name="task" value="'.$task.'" />';
	echo '<input type="hidden" name="act" value="" />';
	echo '<input type="hidden" name="id" value="'.$emnid.'" />';
	echo '<input type="hidden" name="boxchecked" value="0" />';
	echo '<input type="hidden" name="hidemainmenu" value="0" />';
	echo "</form>";
}
Exemplo n.º 2
0
function uddTeaserHead($ofwhat, $howlong, $quotedivider, $utf8) {
	$msgparts=explode($quotedivider, $ofwhat, 2);
	$words=explode(" ", $msgparts[0]);
	$howmanywords=count($words);
	$x=0;
	if (!$howlong)
		$howlong=10;
	$trailstring="";
	if (uddeIM_utf8_strlen($utf8,$msgparts[0])>$howlong) {
		$howlong = $howlong-3;
		$trailstring = "...";
	}
	$construct="";
	if (uddeIM_utf8_strlen($utf8,$words[0])>$howlong) {
		$construct = uddeIM_utf8_substr($useutf8, $words[0], 0, $howlong);
	} else {
		for($x=0; $x < $howmanywords; $x++) {
			$posslen = uddeIM_utf8_strlen($utf8,$construct) + uddeIM_utf8_strlen($utf8,$words[$x]);
			if ($posslen<=$howlong) {
				$construct .= " ".$words[$x];
			} else {
				break;
			}
		}
	}
	$construct .= $trailstring;
	$construct = ltrim($construct);
	if (empty($construct))
		$construct="...";
	return $construct;
}
Exemplo n.º 3
0
function uddeIMreplySuggestion($decryptedmessage, $displaymessage, $fromname, $toname, $isforward, $box, $config) {
	$replysuggest = stripslashes($decryptedmessage);
	// if allowed to contain bbcodes they should be stripped for the reply quote
	if ($displaymessage->systemflag || $config->allowbb)
		$replysuggest = uddeIMbbcode_strip($replysuggest);

	if ($box=="outbox") {
		if ($isforward && $config->allowforwards) {
			$fromname = uddeIMgetNameFromID($displaymessage->fromid, $config);
			if ($config->allowbb)
				$replysuggest="[i]"._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):[/i]\n\n".$replysuggest;
			else
				$replysuggest=""._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):\n\n".$replysuggest;
		}
	} else {
		if ($isforward && $config->allowforwards) {
			if ($displaymessage->toid!=$displaymessage->fromid) { 		// not a copy to myself
				$toname = uddeIMgetNameFromID($displaymessage->toid, $config);
				if ($config->allowbb)
					$replysuggest="[i]"._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):[/i]\n\n".$replysuggest;
				else
					$replysuggest=""._UDDEIM_FWDFROM." ".$fromname." "._UDDEIM_FWDTO." ".$toname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):\n\n".$replysuggest;
			} else {	// its a copy2me
				$toname = uddeIMgetNameFromID($displaymessage->toid, $config);
				if ($config->allowbb)
					$replysuggest="[i]"._UDDEIM_FWDFROM." ".$toname." ".$fromname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):[/i]\n\n".$replysuggest;
				else
					$replysuggest=""._UDDEIM_FWDFROM." ".$toname." ".$fromname." (".uddeLdate($displaymessage->datum, $config, uddeIMgetUserTZ())."):\n\n".$replysuggest;
			}
		}
	}
	$replytomessage = "\n\n\n\n".$config->quotedivider."\n".$replysuggest;

	if ($config->maxlength) {
		if (uddeIM_utf8_strlen($config->languagecharset, $replytomessage)+3>=$config->maxlength) {
			$mlength = $config->maxlength * 2 / 3;
			$replytomessage = uddeIM_utf8_substr($config->languagecharset, $replytomessage,0,$mlength)."...";
		}
	}
	return $replytomessage;
}
Exemplo n.º 4
0
function uddeIMsaveAutoresponderEMN($myself, $item_id, $autorespondertext, $autorespondercheck, $config) {
	// $autorespondercheck contains "on"
	$valueautoresponder = 0;
	if ($autorespondercheck)
		$valueautoresponder=1;
	if ($config->maxlength>0)		// because if 0 do not use any maxlength
		$autorespondertext = uddeIM_utf8_substr($config->languagecharset, $autorespondertext, 0, $config->maxlength);
	if (!uddeIMexistsEMN($myself))
		uddeIMinsertEMNdefaults($myself, $config);
	uddeIMupdateEMNautoresponder($myself, $valueautoresponder);
	if ($valueautoresponder)
		uddeIMupdateEMNautorespondertext($myself, $autorespondertext);
	uddeJSEFredirect("index.php?option=com_uddeim&task=settings&Itemid=".$item_id);
}