/**
  * Sends a PMS message
  *
  *  @param  int      $toUserId         UserId of receiver
  *  @param  int      $fromUserId       UserId of sender
  *  @param  string   $subject          Subject of PMS message
  *  @param  string   $message          Body of PMS message
  *  @param  boolean  $systemGenerated  False: real user-to-user message; True: system-Generated by an action from user $fromid (if non-null)
  *  @return boolean                    True: PM sent successfully; False: PM failed to send
  */
 public function sendUserPMS($toUserId, $fromUserId, $subject, $message, $systemGenerated = false)
 {
     global $_PLUGINS;
     if (!$this->isInstalled()) {
         return false;
     }
     $toUserId = (int) $toUserId;
     $fromUserId = (int) $fromUserId;
     if (!$toUserId) {
         $_PLUGINS->_setErrorMSG(CBTxt::T('SEND_PMS_MISSING_TO_USER', 'Private message failed to send! Error: Missing to user'));
         return false;
     }
     if ($subject) {
         $message = "[b]" . $subject . "[/b]\n\n" . $message;
     }
     $message = $this->htmlToBBCode($message);
     if (!$message) {
         $_PLUGINS->_setErrorMSG(CBTxt::T('SEND_PMS_MISSING_MESSAGE', 'Private message failed to send! Error: Missing message'));
         return false;
     }
     $cryptMode = $this->uddeIMConfig->get('cryptmode', 0, GetterInterface::INT);
     $cryptKey = $this->uddeIMConfig->get('cryptkey', 'uddeIMcryptkey', GetterInterface::STRING);
     $pm = new cbmypmsproTable();
     if ($systemGenerated || !$fromUserId) {
         $fromSystem = $this->uddeIMConfig->get('sysm_username', 'System', GetterInterface::STRING);
         if ($fromUserId) {
             $fromSystem = uddeIMgetNameFromID($fromUserId, $this->uddeIMConfigRAW);
         }
         $pm->set('disablereply', 1);
         $pm->set('systemflag', 1);
         $pm->set('systemmessage', $fromSystem);
     }
     $pm->set('fromid', (int) $fromUserId);
     $pm->set('toid', (int) $toUserId);
     $pm->set('datum', uddetime($this->uddeIMConfig->get('timezone', 0, GetterInterface::INT)));
     if (in_array($cryptMode, array(1, 2, 4))) {
         $pm->set('message', uddeIMencrypt($message, $cryptKey, CRYPT_MODE_BASE64));
         $pm->set('cryptmode', 1);
         $pm->set('crypthash', md5($cryptKey));
     } elseif ($cryptMode == 3) {
         $pm->set('message', uddeIMencrypt($message, '', CRYPT_MODE_STOREBASE64));
         $pm->set('cryptmode', 1);
         $pm->set('crypthash', md5($cryptKey));
     } else {
         $pm->set('message', $message);
     }
     if (uddeIMgetEMNmoderated($pm->get('fromid'))) {
         $pm->set('delayed', 1);
     }
     if (!$pm->store()) {
         $_PLUGINS->_setErrorMSG(CBTxt::T('SEND_PMS_FAILED_ERROR', 'Private message failed to send! Error: [error]', array('[error]' => $pm->getError())));
         return false;
     }
     $this->sendNotification($pm, $message);
     return true;
 }
示例#2
0
function uddeIMshowLists($myself, $item_id, $limit, $limitstart, $config) {
	$pathtosite  = uddeIMgetPath('live_site');

	$my_gid = $config->usergid;

	if( $config->allowmultiplerecipients &&
	   (($config->enablelists==1) ||
	    ($config->enablelists==2 && (uddeIMisSpecial($my_gid) || uddeIMisSpecial2($my_gid, $config))) || 
	    ($config->enablelists==3 && (uddeIMisAdmin($my_gid)) || uddeIMisAdmin2($my_gid, $config))) 
	  ) {
		// ok contact lists are enabled
	} else {
		uddeIMprintMenu($myself, 'lists', $item_id, $config);
		echo "<div id='uddeim-m'>\n";
		echo "<div id='uddeim-overview'><p><b>"._UDDEIM_LISTSNOTENABLED."</b></p></div>\n";
		echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n";
		return;
	}

	if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))
		$total = uddeIMgetUserlistCount($myself, true);
	else
		$total = uddeIMgetUserlistCount($myself);

	// now load messages as required
	if(!$limitstart)
		$limitstart = 0;

	if(!$limit)
		$limit=$config->perpage;

	if ($limitstart>=$total)
		$limitstart=max(0,$limitstart - $limit);

	if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))
		$my_lists = uddeIMselectUserlists($myself, $limitstart, $limit, true);
	else
		$my_lists = uddeIMselectUserlists($myself, $limitstart, $limit);

	// write the uddeim menu
	uddeIMprintMenu($myself, 'lists', $item_id, $config);
	echo "<div id='uddeim-m'>\n";

	uddeIMaddScript($pathtosite."/components/com_uddeim/js/uddeimtools.js");

	echo "<form method='post' name='messages' action='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=listsfork&Itemid=".$item_id)."'>\n";

	echo "<div id='uddeim-overview'><table cellpadding='7' width='100%'>\n";
	$delall="<input type='checkbox' name='arcmes[]' value='' onclick='wiglwogl(this);' title='"._UDDEIM_CHECKALL."' />";
	echo "<tr><th style='text-align:center;' class='sectiontableheader'>".$delall."</th><th class='sectiontableheader'>"._UDDEIM_LISTSNAME."</th><th class='sectiontableheader'>"._UDDEIM_LISTSDESC."</th>";
	echo "<th style='text-align:center;' class='sectiontableheader'>"._UDDEIM_LISTGLOBAL_ENTRIES."</th>";
	if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) 		// admins can create global user lists
		echo "<th style='text-align:center;' class='sectiontableheader'>"._UDDEIM_LISTGLOBAL_TYPE."</th>";
	echo "<th class='sectiontableheader'>&nbsp;</th></tr>\n";

	$i = 1;
	// now write the list
	foreach ( $my_lists as $cl ) {
		$delcell="<input type='checkbox' name='arcmes[]' value='".$cl->id."' />";

		echo "<tr class='sectiontableentry".$i."'>";
		echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$delcell."</td>";		// checkcell
		echo "<td style='vertical-align:middle'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=editlists&listid=".$cl->id."&Itemid=".$item_id)."'>".$cl->name."</a></td>";
		echo "<td style='vertical-align:middle'>".$cl->description;
		if ($cl->userid!=$myself)
			echo "<br /><br />"._UDDEIM_LISTGLOBAL_CREATOR." ".uddeIMgetNameFromID($cl->userid, $config);
		echo "</td>";
		$temp = "0";
		if ($cl->userids)
			$temp = substr_count($cl->userids, ",")+1;
		echo "<td style='text-align:center; vertical-align:middle'>".$temp."</td>";
		if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) {		// admins can create global user lists
			$temp = "";
			switch($cl->global) {
				case 0: $temp = _UDDEIM_LISTGLOBAL_NORMAL; break;
				case 1: $temp = _UDDEIM_LISTGLOBAL_GLOBAL; break;
				case 2: $temp = _UDDEIM_LISTGLOBAL_RESTRICTED; break;
			}
			echo "<td style='text-align:center; vertical-align:middle'>".$temp."</td>";
		}

		if ($config->actionicons) {
			$editcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=editlists&listid=".$cl->id."&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/edit.gif' alt='"._UDDEIM_EDITLINK."' title='"._UDDEIM_EDITLINK."' /></a><br />";
			$deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=deletelists&listid=".$cl->id."&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart)."'><img src='".$pathtosite."/components/com_uddeim/templates/".$config->templatedir."/images/trash.gif' alt='"._UDDEIM_DELETELINK."' title='"._UDDEIM_DELETELINK."' /></a>";
		} else {
			$editcell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=editlists&listid=".$cl->id."&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart)."'>"._UDDEIM_EDITLINK."</a><br />";
			$deletecell="<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=deletelists&listid=".$cl->id."&Itemid=".$item_id."&limit=".$limit."&limitstart=".$limitstart)."'>"._UDDEIM_DELETELINK."</a>";
		}

		if ($config->actionicons) {
			echo "<td style='width:32px; text-align:center; vertical-align:middle'>".$editcell.$deletecell."</td>";
		} else {
			echo "<td class='pathway'>".$editcell.$deletecell."</td>";
		}
		echo "</tr>\n";

		$i++;
		if ($i>2) {
			$i=1;
		}
	}

	$muldel = uddeIMsefRelToAbs("index.php?option=com_uddeim&task=deletelistsmultiple&Itemid=".$item_id."&limitstart=0&limit=".$limit);
	if($config->bottomlineicons) {
		echo "<tr><th style='text-align:center;' class='sectiontablefooter'>";
		echo '<a href="#" onclick="listsDelete(\''.$muldel.'\'); return false;"><img src="'.$pathtosite.'/components/com_uddeim/templates/'.$config->templatedir.'/images/trash.gif" alt="'._UDDEIM_TRASHCHECKED.'" title="'._UDDEIM_TRASHCHECKED.'" /></a></th>';
		echo "<th class='sectiontablefooter'><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=createlists&Itemid=".$item_id)."'>"._UDDEIM_LISTSNEW."</a></th>";
		echo "<th class='sectiontablefooter'>&nbsp;</th><th class='sectiontablefooter'>&nbsp;</th>";
		if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config)) 		// admins can create global user lists
			echo "<th class='sectiontablefooter'>&nbsp;</th>";
		echo "<th class='sectiontablefooter'>&nbsp;</th></tr>\n";
	}
	echo "</table></div>\n";
	echo "</form>\n";

	// write the inbox navigation links
	$pageNav = new uddeIMmosPageNav($total, $limitstart, $limit);
	$referlink = "index.php?option=com_uddeim&task=showlists&Itemid=".$item_id;
	if ($total>$limit) {
		$shownav = $pageNav->writePagesLinks($referlink);
		$shownav = uddeIMarrowReplace($shownav, $config->templatedir);
		echo "<div id='uddeim-pagenav'>".$shownav."<br />";
		echo "[<a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=showlists&Itemid=".$item_id."&limitstart=0&limit=".$total)."'>"._UDDEIM_SHOWALL."</a>]";
		echo "</div>\n";
	}

	echo "<div id='uddeim-bottomlines'>";
	if(!$config->bottomlineicons) {
		echo '<p><a href="#" onclick="listsDelete(\''.$muldel.'\'); return false;">'._UDDEIM_TRASHCHECKED.'</a></p>';
		echo "<p><a href='".uddeIMsefRelToAbs("index.php?option=com_uddeim&task=createlists&Itemid=".$item_id)."'>"._UDDEIM_LISTSNEW."</a></p>";
	}
	echo "</div>\n";

	echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', "", $config)."</div>\n";
}   
示例#3
0
	function sendNewSysMessage($fromid, $recipients, $message, $systemmsg=0, $validfor=0, $sendnotification=0, $forceembedded=0) {
		$database = uddeIMgetDatabase();

		if ($systemmsg) {		// system message
			$sendername = $this->config->sysm_username;
			$savesysflag = addslashes($sendername); 			// system message
			$savedisablereply = 1; 								// and users can't reply to them
			$emn_fromid = 0;									// for email notifications set userid 0
		} else {
			$sendername = uddeIMgetNameFromID($fromid, $this->config);
			$savesysflag = addslashes($sendername);
			$savedisablereply = 0;
			$emn_fromid = $fromid;
		}

		$savedatum = uddetime($this->config->timezone);
		if ($validfor>0) {
			$now = uddetime($this->config->timezone);
			$validuntil = $now+($validfor*3600);
		} else {
			$validuntil = 0;
		}

		if ($this->config->cryptmode>=1) {	// because of encoding do not use slashes
			$savemessage = strip_tags($message);
		} else {
			$savemessage = addslashes(strip_tags($message));   // original 0.6+
		}

		getAdditonalGroups($add_special, $add_admin, $config);
		if (uddeIMcheckJversion()>=2) {		// J1.6
			if ($recipients=="all") {
				$sql="SELECT id FROM #__users WHERE block=0";
			} elseif($recipients=="online") {
				$sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid";
			} elseif($recipients=="special") {
				$sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) 
							INNER JOIN #__usergroups AS g ON um.group_id=g.id 
							WHERE u.block=0 AND g.id IN (3,4,5,6,7,8".$add_admin.$add_special.")";
			} elseif($recipients=="admins") {
				$sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) 
							INNER JOIN #__usergroups AS g ON um.group_id=g.id 
							WHERE u.block=0 AND g.id IN (7,8".$add_admin.")";
			} else {
				$sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) 
							INNER JOIN #__usergroups AS g ON um.group_id=g.id 
							WHERE u.block=0 AND g.id=".(int)$recipients;
			}
		} else {
			if ($recipients=="all") {
				$sql="SELECT id FROM #__users WHERE block=0";
			} elseif($recipients=="online") {
				$sql="SELECT a.id, b.userid FROM #__users AS a, #__session AS b WHERE block=0 AND a.id=b.userid";
			} elseif($recipients=="special") {
				$sql="SELECT id FROM #__users WHERE block=0 AND gid IN (19,20,21,23,24,25".$add_admin.")";
			} elseif($recipients=="admins") {
				$sql="SELECT id FROM #__users WHERE block=0 AND gid IN (24,25".$add_admin.")";
			} else {
				$sql="SELECT id FROM #__users WHERE block=0 AND gid=".(int)$recipients;
			}
		}
		$database->setQuery($sql);
		$receivers=$database->loadObjectList();

		if (!count($receivers)) {
			return 1;
		}

		foreach($receivers as $receiver) {
			$toid = $receiver->id;

			$themode = 0;
			if ($this->config->cryptmode==1 || $this->config->cryptmode==2 || $this->config->cryptmode==4) {
				$themode = 1;
				$cm = uddeIMencrypt($savemessage,$this->config->cryptkey,CRYPT_MODE_BASE64);
				$sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode, crypthash) VALUES (".(int)$fromid.", ".(int)$toid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",1,'".md5($this->config->cryptkey)."')";
			} elseif ($this->config->cryptmode==3) {
				$themode = 3;
				$cm = uddeIMencrypt($savemessage,"",CRYPT_MODE_STOREBASE64);
				$sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox, cryptmode) VALUES (".(int)$fromid.", ".(int)$toid.", '".$cm."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1, ".$savedatum.",3)";
			} else {
				$sql="INSERT INTO #__uddeim (fromid, toid, message, datum, expires, systemmessage, systemflag, disablereply, totrashoutbox, totrashdateoutbox) VALUES (".(int)$fromid.", ".(int)$toid.", '".$savemessage."', ".$savedatum.", ".$validuntil.", '".$savesysflag."', 1,".$savedisablereply.", 1,".$savedatum.")";
			}
			$database->setQuery($sql);
			if (!$database->query()) {
				die("SQL error when attempting to save a message" . $database->stderr(true));
			}
			$insID = $database->insertid();

			if ($sendnotification) {
				// Check if E-Mail notification or popups are enabled by default, if so create a record for the receiver.
				if ($this->config->notifydefault>0 || $this->config->popupdefault>0 || $this->config->pubfrontenddefault>0 || $this->config->autoresponder>0 || $this->config->autoforward>0) {
					if (!uddeIMexistsEMN($toid))
						uddeIMinsertEMNdefaults($toid, $this->config);
				}
			}

			// ##################################################################################################
			// email notification
			// ##################################################################################################

			if ($sendnotification) {
				$currentlyonline = uddeIMisOnline($toid);

				if ($this->config->cryptmode>=1) {
					$email = stripslashes($savemessage);
				} else {
					$email = stripslashes(stripslashes($savemessage));
				}

				$type = 0;
				if ($forceembedded)
					$type = 2;
				if ($this->config->allowemailnotify==1) {
					$ison = uddeIMgetEMNstatus($toid);
					if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) {
						uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $toid, $email, $type, $this->config);
					}
				} elseif($this->config->allowemailnotify==2) {
					$gid = uddeIMgetGID((int)$toid);
					if (uddeIMisAdmin($gid) || uddeIMisAdmin2($gid, $this->config)) {
						$ison = uddeIMgetEMNstatus($toid);
						if (($ison==1) || ($ison==2 && !$currentlyonline) || $ison==10 || ($ison==20 && !$currentlyonline)) {
							uddeIMdispatchEMN($insID, $item_id, $themode, $emn_fromid, $toid, $email, $type, $this->config);
						}
					}
				}
			}
		}
		return 0;
	}
示例#4
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;
}
示例#5
0
function uddeIMarchiveDownload($myself, $item_id, $arcmes, $limit, $limitstart, $cryptpass, $config) {
	$mosConfig_sitename = uddeIMgetSitename();
	
	// if e-mail traffic stopped, don't send.
	if (!$config->emailtrafficenabled) {
		$mosmsg = _UDDEIM_STOPPEDEMAIL;
		uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg);
	}
	
	if (!$config->allowarchive || !$config->enabledownload) {
		$mosmsg = _UDDEIM_ARCHIVENOTENABLED;
		uddeJSEFredirect("HTTP_REFERER", $mosmsg, "archive");
	}

	$n = count($arcmes);
	if(!$n) {
		echo _UDDEIM_NOMSGSELECTED."<br /><a href='javascript:history.go(-1)'>"._UDDEIM_BACK."</a>";
		return;
	}

	$clrf=chr(10);
	$rightnow=uddetime($config->timezone);
	
	$htmlstring="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title>";
	$htmlstring.=$mosConfig_sitename." "._UDDEIM_MESSAGEDOWNLOAD;
	$htmlstring.="</title></head><body><h2>";
	$htmlstring.=_UDDEIM_MESSAGEDOWNLOAD." - ".$mosConfig_sitename;
	$htmlstring.="</h2><h4>".uddeLdate($rightnow, $config, uddeIMgetUserTZ())."</h4><!-- generated by uddeIM messaging component --><table cellspacing=0 cellpadding=4 border=0>";
	
	$exportstring=_UDDEIM_MESSAGEDOWNLOAD." - ".$mosConfig_sitename.$clrf;
	$exportstring.=uddeLdate($rightnow, $config, uddeIMgetUserTZ());
	$exportstring.=$clrf.$clrf.$clrf;
	
	$maindivider="================================================================================".$clrf;
	
	$exportstring.=$maindivider;
	
	for($i = 0; $i <= ($n-1); $i++)	{

		$trashs = uddeIMselectArchiveMessage($myself, $arcmes[$i], $config);
		foreach($trashs as $trash) {

			$fromname = uddeIMevaluateUsername($trash->fromname, $trash->fromid, $trash->publicname);
			if($trash->systemflag)
				$fromname = $trash->systemmessage;

			// $headstring.=" (".uddeLdate($trash->datum, $config, uddeIMgetUserTZ()).")";
			// $headdivider=str_repeat("=", strlen($headstring));
			// $exportstring.="     ".$headstring.$clrf."     ".$headdivider.$clrf.$clrf;
			$cm = uddeIMgetMessage($trash->message, $cryptpass, $trash->cryptmode, $trash->crypthash, $config->cryptkey);
	
			$dlmsg = stripslashes($cm);
			$dlmsg = uddeIMbbcode_strip($dlmsg);
			// $exportstring.=stripslashes($dlmsg);
			// $exportstring.=$clrf.$clrf.$clrf.$clrf;
			// $exportstring.=$maindivider;
			$exportstring.=_UDDEIM_EXPORT_FORMAT;
			$exportstring=str_replace("%user%", $fromname, $exportstring);
			$exportstring=str_replace("%msgdate%", uddeLdate($trash->datum, $config, uddeIMgetUserTZ()), $exportstring);
			$exportstring=str_replace("%msgbody%", $dlmsg, $exportstring);				
		
			$htmlstring.="\n\t<tr bgcolor=#cccccc><td><strong>".$fromname."</strong></td><td align=right>".uddeLdate($trash->datum, $config, uddeIMgetUserTZ())."</td></tr><tr><td>&nbsp;</td><td>";
			$htmlstring.=nl2br(stripslashes($dlmsg));
			$htmlstring.="</td></tr>";
		}
	}
	$htmlstring.="\n</table>\n</body>\n</html>\n";
	
	// we now have $exportstring and $htmlstring (text and html respecitvely) as files with all checked messages (in arcmes[])
//	$ret = uddeIMgetNameEmailFromID($myself, $var_toname, $var_tomail, $config);
	$var_toname = uddeIMgetNameFromID($myself, $config);
	$var_tomail = uddeIMgetEMailFromID($myself, $config);

	if (!$var_tomail) {
		$mosmsg = _UDDEIM_EXPORT_COULDNOTSEND;
		uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg);
	}
	if (!$var_toname)
		$var_toname = "Anonymous";

	$subject = $mosConfig_sitename." "._UDDEIM_MESSAGEDOWNLOAD;
	$var_fromname = $config->emn_sendername;
	$var_frommail = $config->emn_sendermail;

	if(uddeIMsendmail($var_fromname, $var_frommail, $var_toname, $var_tomail, $subject, $exportstring, "", "", "", $config)) {
		$mosmsg = _UDDEIM_EXPORT_MAILED;
	} else {
		$mosmsg = _UDDEIM_EXPORT_COULDNOTSEND;
	}
	uddeJSEFredirect("index.php?option=com_uddeim&task=archive&Itemid=".$item_id, $mosmsg);
}
示例#6
0
function uddeIMpublicNewMessage($item_id, $to_id, $recip, $runame, $pmessage, $config) {

	$recipname="";
	if($recip) {
		$recipname = uddeIMgetNameFromID($recip, $config);
	} elseif ($runame) {
		$recipname = uddeIMgetNameFromID($runame, $config);
	}

	// write the uddeim menu
	uddeIMprintPublicMenu($item_id, $config);
	echo "<div id='uddeim-m'>\n";

	// which page did refer to this page?
	// because we want to send back the user where (s)he came from
	$tbackto = uddeIMmosGetParam( $_SERVER, 'HTTP_REFERER', null );
	if(stristr($tbackto, "com_pms")) {
		$tbackto="";
	}
	uddeIMdrawPublicWriteform($item_id, $tbackto, "", "", $recipname, $pmessage, 0, $config); // isreply, errorcode, sysmsg
	echo "</div>\n<div id='uddeim-bottomborder'></div>\n";
}
示例#7
0
function uddeIMnotifySpam($myself, $item_id, $fromid, $toid, $config) {
	$db = uddeIMgetDatabase();
	$mosConfig_sitename = uddeIMgetSitename();
	$pathtosite  = uddeIMgetPath('live_site');

	if(!$config->emailtrafficenabled) {
		return;
	}
	if(!$config->allowemailnotify) {
		return;
	}
	
	getAdditonalGroups($add_special, $add_admin, $config);
	if (uddeIMcheckJversion()>=2) {		// J1.6
		$sql="SELECT DISTINCT u.id FROM (#__users AS u INNER JOIN #__user_usergroup_map AS um ON u.id=um.user_id) 
				INNER JOIN #__usergroups AS g ON um.group_id=g.id 
				WHERE u.block=0 AND g.id IN (7,8".$add_admin.")";
	} else {
		$sql="SELECT id FROM #__users WHERE block=0 AND gid IN (24,25".$add_admin.")";
	}
	$db->setQuery($sql);
	$receivers = $db->loadObjectList();
	if (!count($receivers)) {
		return;
	}

	foreach($receivers as $receiver) {
		// the admin
		$var_toid = $receiver->id;
		$var_toname = uddeIMgetNameFromID($var_toid, $config);
		$var_tomail = uddeIMgetEMailFromID($var_toid, $config);
		if(!$var_tomail)
			continue;
		if (!$var_toname)
			$var_toname = "Anonymous";
	
		$sname = uddeIMgetNameFromID($fromid, $config);
		$dname = uddeIMgetNameFromID($toid, $config);

		$var_body = _UDDEIM_BODY_SPAMREPORT;
		$var_body = str_replace("%livesite%", $pathtosite, $var_body);
		$var_body = str_replace("%you%", $var_toname, $var_body);
		$var_body = str_replace("%fromuser%", $sname, $var_body);
		$var_body = str_replace("%touser%", $dname, $var_body);
		$var_body = str_replace("%site%", $mosConfig_sitename, $var_body);

		$subject = _UDDEIM_SUBJECT_SPAMREPORT;
		$subject = str_replace("%livesite%", $pathtosite, $subject);
		$subject = str_replace("%you%", $var_toname, $subject);
		$var_body = str_replace("%fromuser%", $sname, $var_body);
		$var_body = str_replace("%touser%", $dname, $var_body);
		$subject = str_replace("%site%", $mosConfig_sitename, $subject);

		$replyto = $var_tomail;
		$replytoname = "";

		if(uddeIMsendmail($config->emn_sendername, $config->emn_sendermail, $var_toname, $var_tomail, $subject, $var_body, $replyto, $replytoname, "", $config)) {
			// 
		}
	}
}
示例#8
0
function uddeIMrecallMessage($myself, $item_id, $messageid, $cryptpass, $config) {
	// this function has three parts
	// first, read the message
	// second, delete the message from the db (complete erase)
	// third, display values for editing

	$my_gid = $config->usergid;

	$displaymessages = uddeIMselectOutboxMessageIfUnread($myself, $messageid, $config);
	if(count($displaymessages)<1) {
		$mosmsg = _UDDEIM_COULDNOTRECALL;
		uddeJSEFredirect("index.php?option=com_uddeim&task=outbox&Itemid=".$item_id, $mosmsg);
	}

	$recipname = "";
	$recalled_message = "";
	foreach($displaymessages as $themessage) {

		// recalling a message to a public user makes no sense since it has been sent anyway
		if ( uddeIMisPublicUser($themessage->toname,$themessage->toid) ) {
			$mosmsg = _UDDEIM_COULDNOTRECALLPUBLIC;
			uddeJSEFredirect("index.php?option=com_uddeim&task=outbox&Itemid=".$item_id, $mosmsg);
		}

		// CRYPT
		$recalled_message = uddeIMgetMessage($themessage->message, $cryptpass, $themessage->cryptmode, $themessage->crypthash, $config->cryptkey);
		$recalled_message = stripslashes($recalled_message);
		$recipname 		  = uddeIMgetNameFromID($themessage->toid, $config);
	}

	// write the uddeim menu
	uddeIMprintMenu($myself, 'new', $item_id, $config);
	echo "<div id='uddeim-m'>\n";
	// delete it from db (after writing the form since I need the message for a query inside of uddeIMdrawWriteform)
	uddeIMpurgeMessageFromUser($myself, $messageid);

	echo "<div id='uddeim-toplines'><p>"._UDDEIM_RECALLEDMESSAGE_INFO."</p></div>\n";
	uddeIMdrawWriteform($myself, $my_gid, $item_id, "", $recipname, $recalled_message, 0, 0, 0, 0, $config);	// allow to select a recipient
	echo "</div>\n<div id='uddeim-bottomborder'>".uddeIMcontentBottomborder($myself, $item_id, 'standard', 'none', $config)."</div>\n";
}