Пример #1
0
function user_delete_ext($userid, $pmsUserDeleteOption) {
	$database = uddeIMgetDatabase();
	$config = new uddeimconfigclass();
	$rightnow = uddetime($config->timezone);

//	$query_pms_delete = "DELETE FROM #__uddeim WHERE fromid='" . (int) $userid ."' OR toid='" . (int) $userid . "'";

	// delete all messages send from this user and trashed from the outbox
	$query_pms_delete1 = "UPDATE #__uddeim SET totrashoutbox=1, totrashdateoutbox=".$rightnow." WHERE fromid='" . (int) $userid . "'";
	// delete all messages recived by this user and trashed from the inbox
	$query_pms_delete2 = "UPDATE #__uddeim SET totrash=1, totrashdate=".$rightnow." WHERE toid='".(int) $userid . "'";

	$query_pms_delete_extra1 = "DELETE FROM #__uddeim_emn WHERE userid='" . (int) $userid . "'";
	$query_pms_delete_extra2 = "DELETE FROM #__uddeim_blocks WHERE blocker='" . (int) $userid . "' OR blocked='" . (int) $userid . "'";
	$query_pms_delete_extra3 = "DELETE FROM #__uddeim_userlists WHERE userid='" . (int) $userid ."'";

	print "Deleting pms data for user ".$userid;

	if ($pmsUserDeleteOption==2 || $pmsUserDeleteOption==4) {
		$database->setQuery( $query_pms_delete1 );
		if (!$database->query()) {
			$this->_setErrorMSG("SQL error " . $query_pms_delete1 . $database->stderr(true));
			return false;			
		}
	}

	if ($pmsUserDeleteOption==2 || $pmsUserDeleteOption==3) {
		$database->setQuery( $query_pms_delete2 );
		if (!$database->query()) {
			$this->_setErrorMSG("SQL error " . $query_pms_delete2 . $database->stderr(true));
			return false;			
		}
	}

	if ($pmsUserDeleteOption>=2) {
		$database->setQuery( $query_pms_delete_extra1 );
		if (!$database->query()) {
			$this->_setErrorMSG("SQL error " . $query_pms_delete_extra1 . $database->stderr(true));
			return false;			
		}
		$database->setQuery( $query_pms_delete_extra2 );
		if (!$database->query()) {
			$this->_setErrorMSG("SQL error " . $query_pms_delete_extra2 . $database->stderr(true));
			return false;			
		}
		$database->setQuery( $query_pms_delete_extra3 );
		if (!$database->query()) {
			$this->_setErrorMSG("SQL error " . $query_pms_delete_extra3 . $database->stderr(true));
			return false;			
		}
	}
	return true;
}
Пример #2
0
function uddeIMselectComboUserlist( $myself, $my_gid, $lids, $config ) {
	$database = uddeIMgetDatabase();
	$users = Array();
	
	getAdditonalGroups($add_special, $add_admin, $config);

	$ret = '<select multiple="multiple" name="userlist" class="inputbox" ondblclick="userlistdblclick(this.selectedIndex, \'listsform\', \'userlist\', \'selectionlist\', '.$config->maxonlists.')" size="10">';

	if (($config->restrictcon==1 && uddeIMisReggedOnly($my_gid)) ||
		($config->restrictcon==2 && uddeIMisAllNotAdmin($my_gid) && !uddeIMisAdmin2($my_gid, $config)) ||
		($config->restrictcon==3) ) {

		if ($lids)
			$temp = "u.id NOT IN (".uddeIMquoteSmart($lids).") AND ";
		$somanyfriends = 0;
		if (uddeIMcheckCB()) {
			$users = uddeIMselectCBbuddies($myself, $config, $temp);
			$somanyfriends = count($users);
		}

		if (!$somanyfriends) { // no friends found, maybe there are some in CBE?
			if (uddeIMcheckCBE()) {
				$users = uddeIMselectCBEbuddies($myself, $config, $temp);
				$somanyfriends = count($users);
			}
			if (uddeIMcheckCBE2()) {
				$users = uddeIMselectCBE2buddies($myself, $config, $temp);
				$somanyfriends = count($users);
			}
		}

		if (!$somanyfriends) { // no friends found, maybe there are some in JS?
			if (uddeIMcheckJS()) {
				$users = uddeIMselectJSbuddies($myself, $config, $temp);
				$somanyfriends = count($users);
			}
		}

	} else {


		if (uddeIMcheckJversion()>=2) {		// J1.6
			$temp = "";
			if ($lids)
				$temp = "AND u.id NOT IN (".uddeIMquoteSmart($lids).") ";
			switch ($config->hideallusers) {
				case 3:		// special users
					$sql="SELECT DISTINCT u.id,u.".($config->realnames ? "name" : "username")." AS displayname 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 ".$temp."AND g.id NOT IN (3,4,5,6,7,8".$add_admin.$add_special.") ORDER BY u.".($config->realnames ? "name" : "username");
					break;
				case 2:		// admins
					$sql="SELECT DISTINCT u.id,u.".($config->realnames ? "name" : "username")." AS displayname 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 ".$temp."AND g.id NOT IN (7,8".$add_admin.") ORDER BY u.".($config->realnames ? "name" : "username");
					break;
				case 1:		// superadmins
					$sql="SELECT DISTINCT u.id,u.".($config->realnames ? "name" : "username")." AS displayname 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 ".$temp."AND g.id NOT IN (8) ORDER BY u.".($config->realnames ? "name" : "username");
					break;
				default:	// none
					$sql="SELECT u.id,u.".($config->realnames ? "name" : "username")." AS displayname FROM #__users AS u WHERE u.block=0 ".$temp."ORDER BY u.".($config->realnames ? "name" : "username");
					break;
			}
			if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))		// do not hide users when it is an admin
				$sql="SELECT u.id,u.".($config->realnames ? "name" : "username")." AS displayname FROM #__users AS u WHERE u.block=0 ".$temp."ORDER BY u.".($config->realnames ? "name" : "username");
		} else {
			$temp = "";
			if ($lids)
				$temp = "AND id NOT IN (".uddeIMquoteSmart($lids).") ";
			switch ($config->hideallusers) {
				case 3:		// special users
					$sql="SELECT id,".($config->realnames ? "name" : "username")." AS displayname FROM #__users WHERE block=0 ".$temp."AND gid NOT IN (19,20,21,23,24,25".$add_admin.$add_special.") ORDER BY ".($config->realnames ? "name" : "username");
					break;
				case 2:		// admins
					$sql="SELECT id,".($config->realnames ? "name" : "username")." AS displayname FROM #__users WHERE block=0 ".$temp."AND gid NOT IN (24,25".$add_admin.") ORDER BY ".($config->realnames ? "name" : "username");
					break;
				case 1:		// superadmins
					$sql="SELECT id,".($config->realnames ? "name" : "username")." AS displayname FROM #__users WHERE block=0 ".$temp."AND gid NOT IN (25) ORDER BY ".($config->realnames ? "name" : "username");
					break;
				default:	// none
					$sql="SELECT id,".($config->realnames ? "name" : "username")." AS displayname FROM #__users WHERE block=0 ".$temp."ORDER BY ".($config->realnames ? "name" : "username");
					break;
			}
			if (uddeIMisAdmin($my_gid) || uddeIMisAdmin2($my_gid, $config))		// do not hide users when it is an admin
				$sql="SELECT id,".($config->realnames ? "name" : "username")." AS displayname FROM #__users WHERE block=0 ".$temp."ORDER BY ".($config->realnames ? "name" : "username");
		}
		$database->setQuery( $sql );
		$users = $database->loadObjectList(); 
		if (!$users)
			$users = Array();
	}

	if ( count( $users ) )  {
		foreach ( $users as $user )
			$ret .= '<option value="'.$user->id.'">'.$user->displayname.'</option>';
	}
	$ret .= '</select>';
	return $ret;
}
Пример #3
0
function uddeIMchangeModerated($option, $task, $emnid, $config) {
	$database = uddeIMgetDatabase();
	$database->setQuery("SELECT moderated FROM #__uddeim_emn WHERE id=".(int)$emnid);
	$value = (int)$database->loadResult();
	$value = 1 - $value;
	$database->setQuery("UPDATE #__uddeim_emn SET moderated=".(int)$value." WHERE id=".(int)$emnid);
	if (!$database->query()) {
		die("SQL error" . $database->stderr(true));
	}
}
Пример #4
0
function uddeIMdownloadAttachments($box, $userid, $item_id, $messageid, $fileid, $config) {
	$database = uddeIMgetDatabase();

	$sql = "";
	if ($box=="downloadOutbox")
		$sql = "SELECT a.* FROM #__uddeim_attachments AS a LEFT JOIN #__uddeim AS b ON a.mid=b.id WHERE a.mid=".(int)$messageid." AND a.id=".(int)$fileid." AND b.fromid=".$userid;
	if ($box=="downloadInbox")
		$sql = "SELECT a.* FROM #__uddeim_attachments AS a LEFT JOIN #__uddeim AS b ON a.mid=b.id WHERE a.mid=".(int)$messageid." AND a.id=".(int)$fileid." AND b.toid=".$userid;

	if ($sql) {
		$database->setQuery( $sql );
		$value = $database->loadObjectList();
		if (!$value)
			$value = Array();

		if (count($value)>0) {

			while (list($key, $row) = each($value)) {
				
				$uploaddir  = uddeIMgetPath('absolute_path')."/images/uddeimfiles";
				if (file_exists($uploaddir."/".$row->tempname)) {

					$temp = pathinfo($row->filename);
					$ext = $temp['extension'];
					// $ct = "application/force-download";
					$ct = uddeIMext2mime($ext);

					// fix for IE catching or PHP bug issue
					header("Pragma: public");
					header("Expires: 0"); // set expiration time
					header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
					header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
					// download
					header("Cache-Control: public");
					header("Content-Description: File Transfer");
					header("Content-Disposition: attachment; filename=\"".$row->filename."\"");
					header("Content-Type: ".$ct);
					header("Content-Transfer-Encoding: binary"); 
					header("Content-Length: ".(int)$row->size);
					error_reporting(0);
					ob_clean();
					// flush();
					readfile($uploaddir."/".$row->tempname);
					exit;	// only one file
				} else {
					echo _UDDEIM_ATT_FILENOTEXISTS;
					exit;
				}
			}
		} else {
			echo _UDDEIM_MESSAGENOACCESS;
		}
	}
	exit;
}
Пример #5
0
function uddeIMreplaceListsWithNames(&$thelist, $myself, $config) {
	$database = uddeIMgetDatabase();

	$ok = 1;
	if ($config->separator==1)
		$objs = explode(";", $thelist);
	else
		$objs = explode(",", $thelist);

	if ($objs==FALSE)
		return 0;	// error

	while (list($key, $obj) = each($objs)) {
		if (substr($obj,0,1)=="#") {				// its a list
			$listname = substr($obj,1);				// remove leading "#"
			// also show global lists
			$this_lists = uddeIMselectUserlistsListFromName($myself, $listname, true);
//			$this_lists = uddeIMselectUserlistsListFromName($myself, $listname);
			if (count($this_lists)>0) {				// we have a list with that name
				$lids = "";
				$ltype = 0;
				$luser = 0;
				foreach($this_lists as $this_list) {
					$lids = trim($this_list->userids);
					$ltype = $this_list->global;
					$luser = $this_list->userid;
				}
				// remove lists if required (1: global list => do not remove; 2: restricted list => remove if not on list or creator)
				if ($ltype==2) {
					$ar_ids = explode(",",$lids);
					$ar_ids[] = $luser;				// the creator of the list is always allowed to access the list
					if (!in_array($myself,$ar_ids))
						$lids = "";
				}
				if ($lids) {
					$obj_new = Array();
					// $database->setQuery( "SELECT id,name,username FROM #__users WHERE block=0 AND id IN (".$lids.") ORDER BY ".($config->realnames ? "name" : "username") );
					// New behavior: Remove myself from the list
					$database->setQuery( "SELECT id,name,username FROM #__users WHERE block=0 AND id IN (".$lids.") AND id<>".$myself." ORDER BY ".($config->realnames ? "name" : "username") );
					$users = $database->loadObjectList();
					if ( count( $users ) )  {
						foreach ( $users as $user )
							array_push($obj_new, ($config->realnames ? $user->name : $user->username));
						if ($config->separator==1)
							$obj = implode(";", $obj_new);
						else
							$obj = implode(",", $obj_new);
					}
					$objs[$key] = $obj;
				} else {
					$objs[$key] = "(".$obj.")";
					$ok = 0;	// error
				}
			} else {
				// we have no list, so check if we have a user with this name
				$ret = uddeIMgetIDfromName($obj, $config, true);
				if (!$ret) {	// no there is no user with that name or user is blocked
					$objs[$key] = "(".$obj.")";
					$ok = 0;	// error
				}
			}
		}	// when it is not a list, do nothing
	}
	if ($config->separator==1)
		$thelist = implode(";", $objs);					// now return the complete list
	else
		$thelist = implode(",", $objs);					// now return the complete list
	return $ok;
}
Пример #6
0
if (!(defined('_JEXEC') || defined('_VALID_MOS'))) {
    die('Direct Access to this location is not allowed.');
}
$uddeim_isadmin = 0;
/*
if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
	require_once(JPATH_SITE.'/components/com_uddeim/uddeimlib15.php');
} else {	
	$app = JFactory::getApplication();
	require_once($app->getCfg('absolute_path').'/components/com_uddeim/uddeimlib10.php');
}
*/
$uddpathtoadmin = uddeIMgetPath('admin');
$uddpathtouser = uddeIMgetPath('user');
$uddpathtosite = uddeIMgetPath('live_site');
$udddatabase = uddeIMgetDatabase();
$uddmosConfig_lang = uddeIMgetLang();
require_once $uddpathtouser . '/crypt.class.php';
require_once $uddpathtoadmin . '/config.class.php';
$uddconfig = new uddeimconfigclass();
if (!defined('_UDDEIM_INBOX')) {
    $uddpostfix = "";
    if ($uddconfig->languagecharset) {
        $uddpostfix = ".utf8";
    }
    if (file_exists($uddpathtoadmin . '/language' . $uddpostfix . '/' . $uddmosConfig_lang . '.php')) {
        include_once $uddpathtoadmin . '/language' . $uddpostfix . '/' . $uddmosConfig_lang . '.php';
    } elseif (file_exists($uddpathtoadmin . '/language' . $uddpostfix . '/english.php')) {
        include_once $uddpathtoadmin . '/language' . $uddpostfix . '/english.php';
    } elseif (file_exists($uddpathtoadmin . '/language/english.php')) {
        include_once $uddpathtoadmin . '/language/english.php';
Пример #7
0
function uddeIMremoveReportSPAM($option, $task, $uddeid, $config) {
	$database = uddeIMgetDatabase();
	if (count($uddeid)) {
		if ($task=='spamremove') {
			foreach($uddeid AS $id) {
				uddeIMdeleteOneReportSPAM($option, $task, 'delete', (int)$id, $config);
			}
		}
		if ($task=='reportremove') {
			foreach($uddeid AS $id) {
				uddeIMdeleteOneReportSPAM($option, $task, 'remove', (int)$id, $config);
			}
		}
	}
	$redirecturl = uddeIMredirectIndex()."?option=$option&task=spamcontrol";
	uddeIMmosRedirect($redirecturl); 
}
Пример #8
0
function uddeIMcheckPMStype() {
	$database = uddeIMgetDatabase();
	$mypmstype = array();

	$tablefound = uddeIMcheckPMS();

	if ( in_array(1, $tablefound) || in_array(2, $tablefound) || in_array(9, $tablefound) || in_array(12, $tablefound) ) {	// _pms found
		$sql = "SHOW FIELDS FROM #__pms;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;
//		$rows = $database->getTableFields(array("#__pms"));
//		$fields = $rows["#__pms"];
//		if ( array_key_exists("groupname"	, $fields) &&

		// check for myPMS II 2.x - Danial Taherzadeh
		if ( in_array("groupname"	, $fields) &&
			 in_array("username"	, $fields) &&
			 in_array("whofrom"		, $fields) &&
			!in_array("recip_id"	, $fields) &&
			!in_array("senderip_id"	, $fields) &&
			 in_array("time"		, $fields)      ) {
			$mypmstype[] = 1;
		}
		// check for myPMS Enhanced 1.x - Stefan Klinger
		if (!in_array("groupname"	, $fields) &&
			 in_array("username"	, $fields) &&
			 in_array("whofrom"		, $fields) &&
			!in_array("recip_id"	, $fields) &&
			!in_array("senderip_id"	, $fields) &&
			 in_array("time"		, $fields)      ) {
			$mypmstype[] = 12;
		}
		// check for myPMS Enhanced 2.x - Stefan Klingner
		if (!in_array("groupname"	, $fields) &&
			!in_array("username" 	, $fields) &&
			!in_array("whofrom"  	, $fields) &&
			 in_array("recip_id" 	, $fields) &&
			 in_array("sender_id"	, $fields) &&
			 in_array("time"     	, $fields)      ) {
			$mypmstype[] = 2;
		}
		// check for myPMS OS 2.x - Danial Taherzadeh
		if (!in_array("groupname"	, $fields) &&
			 in_array("username"	, $fields) &&
			 in_array("whofrom"		, $fields) &&
			!in_array("recip_id"	, $fields) &&
			!in_array("senderip_id"	, $fields) &&
			!in_array("time"		, $fields)      ) {
			$mypmstype[] = 9;
		}

	}
	
	if ( in_array(3, $tablefound) || in_array(11, $tablefound) ) {	// _jim found
		$sql = "SHOW FIELDS FROM #__jim;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for jim - Laurent Belloeil
		if (!in_array("inbox"		, $fields) &&
			 in_array("username"	, $fields) &&
			 in_array("whofrom"		, $fields) &&
			 in_array("outbox"		, $fields) &&
			 in_array("date"		, $fields) &&
			 in_array("readstate"	, $fields)      ) {
			$mypmstype[] = 3;
		}
		// check for jim reloaded - Edi Goetschel
		if ( in_array("inbox"		, $fields) &&
			 in_array("username"	, $fields) &&
			 in_array("whofrom"		, $fields) &&
			 in_array("outbox"		, $fields) &&
			 in_array("date"		, $fields) &&
			 in_array("readstate"	, $fields)      ) {
			$mypmstype[] = 11;
		}

	}
	
	if ( in_array(4, $tablefound) ) {	// _abim_data
		$sql = "SHOW FIELDS FROM #__abim_data;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;
		// check for Archaic Binary Private Messages not required
		$mypmstype[] = 4;

	}
	
	if ( in_array(5, $tablefound) ) {	// _jam
		$sql = "SHOW FIELDS FROM #__jam;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;
		// check for JAM not required
		$mypmstype[] = 5;

	}
	
	if ( in_array(6, $tablefound) || in_array(10, $tablefound) ) {	// _mypms 
		$sql = "SHOW FIELDS FROM #__mypms;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for Clexus 2.0
		if ( in_array("sent_id"		, $fields) &&
			 in_array("userid"		, $fields) &&
			 in_array("whofrom"		, $fields) &&
			 in_array("replyid"		, $fields) &&
			 in_array("pm_notify"	, $fields) &&
			 in_array("owner"		, $fields)      ) {
			$mypmstype[] = 6;
		}
		// check for myPMS Pro
		if ( in_array("sent_id"		, $fields) &&
			!in_array("userid"		, $fields) &&
			 in_array("whofrom"		, $fields) &&
			 in_array("replyid"		, $fields) &&
			!in_array("pm_notify"	, $fields) &&
			 in_array("owner"		, $fields)      ) {
			$mypmstype[] = 10;
		}
	}
	
	if ( in_array(7, $tablefound) ) {	// _missus
		$sql = "SHOW FIELDS FROM #__missus;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for Missus 1.x
		if ( in_array("senderid"	, $fields) &&
			 in_array("sendername"	, $fields) &&
			 in_array("datesended"	, $fields) &&
			 in_array("sdr_rstate"	, $fields) &&
			 in_array("broadcast"	, $fields) &&
			 in_array("message"		, $fields)      ) {
			$mypmstype[] = 7;

		} 
	}
	
	if ( in_array(8, $tablefound) ) {	// __primezilla_inbox
		$sql = "SHOW FIELDS FROM #__primezilla_inbox;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for Primezilla 1.0
		if ( in_array("userid"		, $fields) &&
			 in_array("userid_from"	, $fields) &&
			 in_array("msg_date"	, $fields) &&
			 in_array("message"		, $fields) &&
			 in_array("flag_read"	, $fields) &&
			 in_array("marker"		, $fields)      ) {
			$mypmstype[] = 8;
		}
	}

	if ( in_array(13, $tablefound) ) {	// __community_msg_recepient
		$sql = "SHOW FIELDS FROM #__community_msg_recepient;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for JomSocial 1.0
		if ( in_array("msg_id"		, $fields) &&
			 in_array("msg_parent"	, $fields) &&
			 in_array("msg_from"	, $fields) &&
			 in_array("to"			, $fields) &&
			 in_array("bcc"			, $fields) &&
			 in_array("is_read"		, $fields)      ) {
			$mypmstype[] = 13;
		}
	}

	if ( in_array(14, $tablefound) ) {	// __messaging
		$sql = "SHOW FIELDS FROM #__messaging;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for Messaging 1.5
		if ( in_array("idFrom"		, $fields) &&
			 in_array("idTo"		, $fields) &&
			 in_array("subject"		, $fields) &&
			 in_array("seen"		, $fields) &&
			 in_array("message"		, $fields) &&
			 in_array("date"		, $fields)      ) {
			$mypmstype[] = 14;
		}
	}

	if ( in_array(15, $tablefound) ) {	// __cdpuremessenger
		$sql = "SHOW FIELDS FROM #__cdpuremessenger;";
		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows)
			$rows = Array();
		$fields = Array();
		foreach ($rows as $row)
			$fields[]=$row->Field;

		// check for CD Pure Messenger 1.x
		if ( in_array("from_id"		, $fields) &&
			 in_array("to_id"		, $fields) &&
			 in_array("message"		, $fields) &&
			 in_array("from_created", $fields) &&
			 in_array("from_ip"		, $fields) &&
			 in_array("to_read"		, $fields)      ) {
			$mypmstype[] = 15;
		}
	}

	return $mypmstype;
}
Пример #9
0
function uddeIMpreSaveAttachmentsRemove($config) {
	$database = uddeIMgetDatabase();
	$uploaddir = uddeIMgetPath('absolute_path')."/images/uddeimfiles";
	
	$sql = "SELECT * FROM #__uddeim_attachments WHERE mid=-1";
	$database->setQuery( $sql );
	$value = $database->loadObjectList();
	if (!$value)
		$value = Array();

	if (count($value)>0) {		// we have temporary file markers, so remove the files and all entries
		while (list($key, $row) = each($value)) {
			if (file_exists($uploaddir."/".$row->tempname))
				unlink($uploaddir."/".$row->tempname);
		}
		$sql = "DELETE FROM #__uddeim_attachments WHERE mid=-1";
		$database->setQuery($sql);
		if (!$database->query())
			die("SQL error when attempting to delete temporary attachment markers" . $database->stderr(true));
	}
}
Пример #10
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)) {
			// 
		}
	}
}
Пример #11
0
function uddeIMrssFeedPlugin($versionstring, $userid, $config) {
	$database = uddeIMgetDatabase();
	$sitename = uddeIMgetSitename();
	$live_site = uddeIMgetPath('live_site');

	$Itemid 	= uddeIMmosGetParam( $_REQUEST, 'Itemid');
	if (!$Itemid || !isset($Itemid) || empty( $Itemid )) {
		$Itemid = uddeIMgetItemid($config);
	} else if ($config->overwriteitemid) {
		$Itemid = (int)$config->useitemid;
	}
	$item_id = (int)$Itemid;

	$username = stripslashes( strval( uddeIMmosGetParam ($_REQUEST, 'user', '') ));
	$passwd   = stripslashes( strval( uddeIMmosGetParam ($_REQUEST, 'pass', '') ));
	$showall  = (int) uddeIMmosGetParam ($_REQUEST, 'showall', 0);
	$type  	  = (int) uddeIMmosGetParam ($_REQUEST, 'type', 0);

	$row = uddeIMselectUserrecordFromUsername($username, $config);
	if ($row) {
		if ($row->block) {
			uddeIMrssOutputHeader($versionstring);
			uddeIMrssOutputItem($type, "Code=5", _UDDEIM_RSS_USERBLOCKED, "");
			uddeIMrssOutputFooter();
			return;
		}
		$gid = uddeIMgetGID($row->id);	// $userid
		if (!$config->enablerss || ($config->enablerss==2 && !uddeIMisAdmin($gid) && !uddeIMisAdmin2($gid, $config))) {
			uddeIMrssOutputHeader($versionstring);
			uddeIMrssOutputItem($type, "Code=2", _UDDEIM_RSS_NOTALLOWED, "");
			uddeIMrssOutputFooter();
			return;
		}
		
		if ((strpos($row->password, ':') === false) && $row->password == md5($passwd)) {
			// Old password hash storage but authentic ... lets convert it
			$salt = uddeIMmosMakePassword(16);
			$crypt = md5($passwd.$salt);
			$row->password = $crypt.':'.$salt;
		}
		list($hash, $salt) = explode(':', $row->password);

		$hash_db   = sha1($hash);		// the hash value from the user database
		$hash_post = $passwd;
		if ($hash_db != $hash_post) {
			uddeIMrssOutputHeader($versionstring);
			uddeIMrssOutputItem($type, "Code=3", _UDDEIM_RSS_WRONGPASSWORD, "");
			uddeIMrssOutputFooter();
			return;
		}

		uddeIMrssOutputHeader($versionstring);

		$filter = "";
		if (!$showall) {
			$filter = "AND a.toread=0 ";
		}

		$limit = "";
		if ($config->rsslimit)
			$limit = " LIMIT ".(int)$config->rsslimit;
			
		$userid = uddeIMgetIDfromUsername($username, $config, true);
		$sql = "SELECT a.*, b.".($config->realnames ? "name" : "username")." AS fromname FROM #__uddeim AS a LEFT JOIN #__users AS b ON a.fromid=b.id WHERE a.toid=".(int)$userid." AND a.totrash=0 AND a.archived=0 AND `a`.`delayed`=0 ".$filter."ORDER BY a.datum DESC".$limit;

		$database->setQuery($sql);
		$rows = $database->loadObjectList();
		if (!$rows) {
			$pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim&Itemid=".$item_id);
			uddeIMrssOutputItem($type,($showall ? "Code=0" : "Code=1"),
									  ($showall ? _UDDEIM_RSS_NOMESSAGES : _UDDEIM_RSS_NONEWMESSAGES), 
									  "", $pms_show);
		} else {
			foreach ($rows as $row) {
				$fromname = uddeIMevaluateUsername($row->fromname, $row->fromid, $row->publicname);
				if($row->systemmessage)
					$fromname = $row->systemmessage;
				if ($row->cryptmode==2)
					$pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim&Itemid=".$item_id."&task=showpass&messageid=".$row->id);
				else
					$pms_show = uddeIMsefRelToAbs("index.php?option=com_uddeim&Itemid=".$item_id."&task=show&messageid=".$row->id);
				$cm = uddeIMgetMessage($row->message, "", $row->cryptmode, "", $config->cryptkey);
				$cm = stripslashes($cm);
				if($row->systemflag || $config->allowbb) {					
					$cm = uddeIMbbcode_strip($cm);
				}
				$cm = htmlspecialchars($cm, ENT_QUOTES, $config->charset);
				$cm = str_replace("&amp;#", "&#", $cm); 

				$title = $fromname.": ".substr($cm,0,30);
				$pubdate = date("r",$row->datum);
				$desc = substr($cm,0,500);
				uddeIMrssOutputItem(0, "", $title, $desc, $pms_show, $pubdate);
			}
		}
		uddeIMrssOutputFooter();

	} else {
		uddeIMrssOutputHeader($versionstring);
		uddeIMrssOutputItem($type, "Code=4", _UDDEIM_RSS_NOOBJECT, "");
		uddeIMrssOutputFooter();
	}
}
Пример #12
0
function uddeIMselectUserrecordFromUsername($username, $config) {
	$database = uddeIMgetDatabase();
	// $sql = "SELECT id, name, username, password, usertype, block FROM #__users WHERE username="******"SELECT id, name, username, password, block FROM #__users WHERE username="******"";
	foreach($values as $value)
		$row = $value;
	return $row;
}
Пример #13
0
function uddeIMremoveMessage($option, $task, $uddeid, $config) {
	$database = uddeIMgetDatabase();
	if (count($uddeid)) {
		if ($task=='messageremove') {
			foreach($uddeid AS $id) {
				uddeIMdeleteOnemessage($option, $task, 'delete', (int)$id, $config);
			}
		}
		if ($task=='messagedeliver') {
			foreach($uddeid AS $id) {
				uddeIMdeleteOnemessage($option, $task, 'deliver', (int)$id, $config);
			}
		}
	}
	$redirecturl = uddeIMredirectIndex()."?option=$option&task=mcp";
	uddeIMmosRedirect($redirecturl); 
}
Пример #14
0
function uddeIMgetPicOnly($ofanid, $config, $noanchor=false) {		// PIC only
	$mosConfig_lang = uddeIMgetLang(); 
	$database = uddeIMgetDatabase();
	$gimmeback = "";

	$grsize = 80;
	if ($config->avatarw)
		$grsize = $config->avatarw;

	$picstyle = "";
	if ($config->avatarw || $config->avatarh) {
		$picstyle = " style='";
		if ($config->avatarw)
			$picstyle .= "max-width: ".$config->avatarw."px; ";
		if ($config->avatarh)
			$picstyle .= "max-height: ".$config->avatarh."px; ";
		$picstyle .= "'";
	}

	if ($config->showcbpic==1) {	// CB

		if (is_dir(uddeIMgetPath('absolute_path')."/components/com_comprofiler/plugin/language/".$mosConfig_lang."/images"))
			$fileLang=$mosConfig_lang;
		else
			$fileLang="default_language";

		$sql="SELECT avatar FROM #__comprofiler WHERE user_id=".(int)$ofanid." LIMIT 1";
		$database->setQuery($sql);
		$ofanavatar=$database->loadResult();

		$filenamelocal  = "/images/comprofiler/tn".$ofanavatar;									// Thumbnail
		$filenamelive   = uddeIMgetPath('live_site')    ."/images/comprofiler/tn".$ofanavatar;	// Thumbnail

		$filenameglocal = "/images/comprofiler/".$ofanavatar;									// Gallery
		$filenameglive  = uddeIMgetPath('live_site')    ."/images/comprofiler/".$ofanavatar;	// Gallery

		// NOPHOTO for CB
		$filename2local = "/components/com_comprofiler/plugin/language/".$fileLang."/images/tnnophoto.jpg";
		$filename2live  = uddeIMgetPath('live_site')    ."/components/com_comprofiler/plugin/language/".$fileLang."/images/tnnophoto.jpg";

		// NOPHOTO for CBE
		$filename3local = "/images/".$fileLang."/tnnophoto.jpg";
		$filename3live  = uddeIMgetPath('live_site')    ."/images/".$fileLang."/tnnophoto.jpg";

		// NOPHOTO for CB 2.0
		$filename4local = "/components/com_comprofiler/plugin/templates/default/images/avatar/tnnophoto_n.png";
		$filename4live  = uddeIMgetPath('live_site')    ."/components/com_comprofiler/plugin/templates/default/images/avatar/tnnophoto_n.png";


		// CB 2.0
//		$cbUser =& CBuser::getInstance( $ofanid );
//		if ( !$cbUser )
//			$cbUser =& CBuser::getInstance( null );
//		$avatar = $cbUser->getField( 'avatar', null, 'html', 'none', 'list' );

		
		if (uddeIMfileExists($filenamelocal)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenamelive."' alt='' />";
		} elseif (uddeIMfileExists($filenameglocal) && $config->CBgallery) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
		} elseif ($config->gravatar) {
			$email = uddeIMgetEMailFromID((int)$ofanid, $config);
			$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
		} elseif (uddeIMfileExists($filename4local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename4live."' alt='' />";
		} elseif (uddeIMfileExists($filename2local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename2live."' alt='' />";
		} elseif (uddeIMfileExists($filename3local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename3live."' alt='' />";
		} else {
			$imgurl = "NOPHOTO";
		}
		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==2) {		// FB

		$sql="SELECT avatar FROM #__fb_users WHERE userid=".(int)$ofanid." LIMIT 1";
		$database->setQuery($sql);
		$ofanavatar=$database->loadResult();

		$filenameglocal = "/images/fbfiles/avatars/".$ofanavatar;									// Gallery
		$filenameglive  = uddeIMgetPath('live_site')    ."/images/fbfiles/avatars/".$ofanavatar;	// Gallery

		$filename2local = "/images/fbfiles/avatars/s_nophoto.jpg";
		$filename2live  = uddeIMgetPath('live_site')    ."/images/fbfiles/avatars/s_nophoto.jpg";

		if (uddeIMfileExists($filenameglocal)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
		} elseif ($config->gravatar) {
			$email = uddeIMgetEMailFromID((int)$ofanid, $config);
			$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
		} elseif (uddeIMfileExists($filename2local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename2live."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==3) {		// Agora
//		$database->setQuery("UPDATE #__agora_config SET conf_value=$conf_value WHERE conf_name='$conf_name'");
//		$dbresult = $database->query();

		$adir = "";
		$useavatars = 0;
		if (uddeIMfileExists("/components/com_agora/cache/cache_config.php")) {
			include(uddeIMgetPath('absolute_path')."/components/com_agora/cache/cache_config.php");
			if (isset($agora_config['o_avatars_dir'])) {
				$adir = $agora_config['o_avatars_dir'];
			}
			if (isset($agora_config['o_avatars'])) {
				$useavatars = $agora_config['o_avatars'];
			}
		}
		if (!$adir)
			return $gimmeback;

		$sql = "SELECT id, show_avatars FROM #__agora_users WHERE jos_id=".(int)$ofanid;
		$database->setQuery($sql);

		$results = $database->loadObjectList();
		if (!$results) {
			$agoraid = "notfound";
			$showavatars = 0;
		} else {
			foreach($results as $result) {
				$agoraid 	 = $result->id;
				$showavatars = $result->show_avatars;
			}
		}
//		$value = NULL;
//		if ($database->loadObject($value)) {
//			$agoraid = $value->id;
//			$showavatars = $value->show_avatars;
//		} else {
//			$agoraid = "notfound";
//			$showavatars = 0;
//		}

		$pic1 = "/".$agoraid.".gif";
		$pic2 = "/".$agoraid.".jpg";
		$pic3 = "/".$agoraid.".png";
		
		$filename1local = "/".$adir.$pic1;
		$filename1live  = uddeIMgetPath('live_site')    ."/".$adir.$pic1;
		$filename2local = "/".$adir.$pic2;
		$filename2live  = uddeIMgetPath('live_site')    ."/".$adir.$pic2;
		$filename3local = "/".$adir.$pic3;
		$filename3live  = uddeIMgetPath('live_site')    ."/".$adir.$pic3;
		$filename4local = "/".$adir."/noavatar_sm.gif";
		$filename4live  = uddeIMgetPath('live_site')    ."/".$adir."/noavatar_sm.gif";

		if (uddeIMfileExists($filename1local) && $useavatars && $showavatars) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename1live."' alt='' />";
		} elseif (uddeIMfileExists($filename2local) && $useavatars && $showavatars) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename2live."' alt='' />";
		} elseif (uddeIMfileExists($filename3local) && $useavatars && $showavatars) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename3live."' alt='' />";
		} elseif ($config->gravatar) {
			$email = uddeIMgetEMailFromID((int)$ofanid, $config);
			$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
		} elseif (uddeIMfileExists($filename4local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename4live."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==4) {	// CBE (new)

		if (is_dir(uddeIMgetPath('absolute_path')."/components/com_cbe/plugin/language/".$mosConfig_lang."/images"))
			$fileLang=$mosConfig_lang;
		else
			$fileLang="default_language";

		$sql="SELECT avatar FROM #__cbe WHERE user_id=".(int)$ofanid." LIMIT 1";
		$database->setQuery($sql);
		$ofanavatar=$database->loadResult();

		$filenamelocal  = "/images/cbe/tn".$ofanavatar;									// Thumbnail
		$filenamelive   = uddeIMgetPath('live_site')    ."/images/cbe/tn".$ofanavatar;	// Thumbnail

		$filenameglocal = "/images/cbe/".$ofanavatar;									// Gallery
		$filenameglive  = uddeIMgetPath('live_site')    ."/images/cbe/".$ofanavatar;	// Gallery

		// NOPHOTO for CBE new
		$filename3local = "/components/com_cbe/images/".$fileLang."/tnnophoto.jpg";
		$filename3live  = uddeIMgetPath('live_site')    ."/components/com_cbe/images/".$fileLang."/tnnophoto.jpg";

		if (uddeIMfileExists($filenamelocal)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenamelive."' alt='' />";
		} elseif (uddeIMfileExists($filenameglocal) && $config->CBgallery) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
		} elseif ($config->gravatar) {
			$email = uddeIMgetEMailFromID((int)$ofanid, $config);
			$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
		} elseif (uddeIMfileExists($filename3local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename3live."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==5) {		// KUNENA

		$sql="SELECT avatar FROM #__fb_users WHERE userid=".(int)$ofanid." LIMIT 1";
		$database->setQuery($sql);
		$ofanavatar=$database->loadResult();

		$filenameglocal = "/images/fbfiles/avatars/".$ofanavatar;									// Gallery
		$filenameglive  = uddeIMgetPath('live_site')    ."/images/fbfiles/avatars/".$ofanavatar;	// Gallery

		$filename2local = "/images/fbfiles/avatars/s_nophoto.jpg";
		$filename2live  = uddeIMgetPath('live_site')    ."/images/fbfiles/avatars/s_nophoto.jpg";

		if (uddeIMfileExists($filenameglocal)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
		} elseif ($config->gravatar) {
			$email = uddeIMgetEMailFromID((int)$ofanid, $config);
			$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
		} elseif (uddeIMfileExists($filename2local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename2live."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==6) {		// JOMSOCIAL, no gravatar

		if (class_exists('CFactory')) {
			$jsuser = CFactory::getUser((int)$ofanid);
			$filenameglive = $jsuser->getThumbAvatar();
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==7) {		// AUP, no gravatar

		$api_AUP = JPATH_SITE.'/components/com_alphauserpoints/helper.php';
		if ( file_exists($api_AUP) ) {
			require_once($api_AUP);
			if ($config->avatarw && $config->avatarh)
				$avatar = AlphaUserPointsHelper::getAupAvatar($ofanid, 0, $config->avatarw, $config->avatarh);
			else
				$avatar = AlphaUserPointsHelper::getAupAvatar($ofanid, 0);	// [int $width], [int $height]
			$imgurl = $avatar;
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==8) {		// JooCM

		$avatarFile = "";
		$sql = "SELECT a.* FROM #__joocm_avatars AS a INNER JOIN #__joocm_users AS u ON u.id_avatar = a.id WHERE u.id = ".(int)$ofanid;
		$database->setQuery($sql);
		$avatar = $database->loadObject();
		if (is_object($avatar)) {
			$pos = strpos($avatar->avatar_file, 'http://');
			if ($pos === false) {
				if ($avatar->avatar_file) {
					$avatarFile = uddeIMgetPath('live_site')."/media/joocm/avatars/";
					if ($avatar->id_user) {
						$avatarFile .= $avatar->id_user.'/'.$avatar->avatar_file;
					} else {
						$avatarFile .= 'standard/'.$avatar->avatar_file;
					}
				}
			} else {
				$avatarFile = $avatar->avatar_file;
			}
		}
		if (!$avatarFile) {
			if ($config->gravatar) {
				$email = uddeIMgetEMailFromID((int)$ofanid, $config);
				$avatarFile = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			} else {
				$avatarFile = uddeIMgetPath('live_site').'/media/joocm/avatars/standard/_cm_noavatar.png';
			}
		}

		if ($avatarFile) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$avatarFile."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==9) {		// KUNENA 1.6+

		// $api_KUN = JPATH_SITE.'/components/com_kunena/lib/kunena.config.class.php';
		// if ( file_exists($api_KUN) ) {
		// 	require_once($api_KUN);
		// 	$kcfg = KunenaFactory::getConfig();
		//}
		
		$sql="SELECT avatar FROM #__kunena_users WHERE userid=".(int)$ofanid." LIMIT 1";
		$database->setQuery($sql);
		$ofanavatar=$database->loadResult();

		$filenameglocal = "/media/kunena/avatars/".$ofanavatar;
		$filenameglive  = uddeIMgetPath('live_site')    ."/media/kunena/avatars/".$ofanavatar;

		$filename2local = "/media/kunena/avatars/s_nophoto.jpg";
		$filename2live  = uddeIMgetPath('live_site')    ."/media/kunena/avatars/s_nophoto.jpg";

		if (uddeIMfileExists($filenameglocal)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";
		} elseif ($config->gravatar) {
			$email = uddeIMgetEMailFromID((int)$ofanid, $config);
			$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
		} elseif (uddeIMfileExists($filename2local)) {
			$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filename2live."' alt='' />";
		}

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==10) {		// NINJABOARD

		// $filenameglocal = "/media/com_ninjaboard/images/avatars/".$ofanid."/avatar.png";
		// $filenameglive  = uddeIMgetPath('live_site')    ."/media/com_ninjaboard/images/avatars/".$ofanid."/avatar.png";

		// if (uddeIMfileExists($filenameglocal)) {
		// 	$gimmeback = uddeIMgetLinkOnly($ofanid, "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />", $config);
		// }

		$filenameglive  = uddeIMgetPath('live_site')    ."/index.php?view=avatar&id=".$ofanid."&thumbnail=large";
		$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$filenameglive."' alt='' />";

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	} elseif ($config->showcbpic==11 || $config->showcbpic==12) {		// KUNENA 2.0+, 3.0+

		$sizex = $sizey = $grsize;
		$class = 'avatar';
		
		KunenaForum::setup();
	    $isInstalled = KunenaForum::installed ();
		if ($isInstalled) {

			$user = KunenaUserHelper::get($ofanid);        
			// $user = KunenaFactory::getUser();
	 
			// Get avatar URL "/media/kunena/avatars/path/file.jpg"
			$avatarUrl = $user->getAvatarURL($sizex, $sizey);
			// Get avatar <img> tag
			$avatarHtml = $user->getAvatarImage($class, $sizex, $sizey);
			// Get profile link with avatar pointing to profile page
			$userLink = $user->getLink(null, $avatarHtml);

			$filenameglocal = $avatarUrl;
			$filenameglive  = $avatarHtml;

	  		if (!empty($avatarUrl)) {			
				$imgurl = $filenameglive;
			} elseif ($config->gravatar) {
				$email = uddeIMgetEMailFromID((int)$ofanid, $config);
				$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
				$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";
			} else {
				$imgurl = "";
			}

			if ($noanchor)
				$gimmeback = $imgurl;
			else
				$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

		}

	} elseif ($config->showcbpic==0 && $config->gravatar) {		// disabled, but gravatar enabled
		$email = uddeIMgetEMailFromID((int)$ofanid, $config);
		$grurl = uddeIMgetGravatar($email, $grsize, $config->gravatard, $config->gravatarr);
		$imgurl = "<img class='uddeim-tn'".$picstyle." src='".$grurl."' alt='' />";

		if ($noanchor)
			$gimmeback = $imgurl;
		else
			$gimmeback = uddeIMgetLinkOnly($ofanid, $imgurl, $config);

	}
	return $gimmeback;
}
Пример #15
0
function uddeIMquoteSmart($source) { 
	$database = uddeIMgetDatabase();
	if (get_magic_quotes_gpc()) { 
		$source = stripslashes($source);
	}
	$source = $database->getEscaped( $source );
	return $source; 
} 
Пример #16
0
function uddeIMgetPostboxUserCount($myself, $userid, $filter_user=0, $filter_unread=0, $filter_flagged=0) {
	$database = uddeIMgetDatabase();
	$filter="";
	if ($filter_user) $filter = " WHERE a.fromid=".(int)$filter_user;
	if ($filter_user==-1) $filter = " WHERE a.fromid=0";
	if ($filter_unread) $filter .= " AND a.toread=0";
	if ($filter_flagged) $filter .= " AND a.flagged<>0";

	$filterout = "";
	if ($filter_user) $filterout = " AND a.toid=".(int)$filter_user;
	if ($filter_user==-1) $filterout = " AND a.toid=0";
	$sql = "
			SELECT count(a.id) 		 
			FROM #__uddeim AS a 		 
			WHERE (a.totrash=0    AND a.toid=".(int)$myself." AND a.fromid=".(int)$userid.$filter.")
			   OR (a.totrashoutbox=0 AND a.fromid=".(int)$myself." AND a.toid=".(int)$userid.$filterout.")";
	$database->setQuery($sql);
	$total = (int)$database->loadResult();
	return $total;
}
Пример #17
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;
	}
Пример #18
0
function uddeIMdoPublicShowAllUsers($config) {						
	$database = uddeIMgetDatabase();

	$hide = "";
	if ($config->pubhideusers)
		$hide = "AND a.id NOT IN (".uddeIMquoteSmart($config->pubhideusers).") ";

	$hide2 = "";
	if ($config->pubblockgroups)
		$hide2 = "AND gid NOT IN (".uddeIMquoteSmart($config->pubblockgroups).") ";

	switch ($config->pubhideallusers) {
		case 3:		// special users
			$sql="SELECT a.".($config->pubrealnames ? "name" : "username")." AS displayname FROM #__users AS a, #__uddeim_emn AS b WHERE a.id=b.userid AND b.public=1 AND a.block=0 AND gid NOT IN (19,20,21,23,24,25) ".$hide.$hide2."ORDER BY a.".($config->pubrealnames ? "name" : "username");
			break;
		case 2:		// admins
			$sql="SELECT a.".($config->pubrealnames ? "name" : "username")." AS displayname FROM #__users AS a, #__uddeim_emn AS b WHERE a.id=b.userid AND b.public=1 AND a.block=0 AND gid NOT IN (24,25) ".$hide.$hide2."ORDER BY a.".($config->pubrealnames ? "name" : "username");
			break;
		case 1:		// superadmins
			$sql="SELECT a.".($config->pubrealnames ? "name" : "username")." AS displayname FROM #__users AS a, #__uddeim_emn AS b WHERE a.id=b.userid AND b.public=1 AND a.block=0 AND gid NOT IN (25) ".$hide.$hide2."ORDER BY a.".($config->pubrealnames ? "name" : "username");
			break;
		default:	// none
			$sql="SELECT a.".($config->pubrealnames ? "name" : "username")." AS displayname FROM #__users AS a, #__uddeim_emn AS b WHERE a.id=b.userid AND b.public=1 AND a.block=0 ".$hide.$hide2."ORDER BY a.".($config->pubrealnames ? "name" : "username");
			break;
	}

	$database->setQuery($sql);
	$rows=$database->loadObjectList();
	if (count($rows)>0) {
		$allnames="<select size=\"1\" class=\"inputbox\" name=\"userlist\" onchange=\"document.sendeform.to_name.value=document.sendeform.userlist.value; return false;\">";
		$allnames.="<option value=\"\">&nbsp;</option>";
		foreach ($rows as $row)
			$allnames.="<option value=\"".$row->displayname."\">".$row->displayname."</option>";
		$allnames.="</select>";
		echo _UDDEIM_USERLIST."<br />";
		echo $allnames;
	}
}
Пример #19
0
function uddeIM_com_install() {
	$ver = new JVersion();

	if ( defined( 'JPATH_ADMINISTRATOR' ) ) {
		require_once(JPATH_SITE.'/components/com_uddeim/uddeimlib.php');
		require_once(JPATH_SITE.'/administrator/components/com_uddeim/admin.uddeimlib.php');
	} else {
		global $mainframe;
		require_once($mainframe->getCfg('absolute_path').'/components/com_uddeim/uddeimlib.php');
		require_once($mainframe->getCfg('absolute_path').'/administrator/components/com_uddeim/admin.uddeimlib.php');
	}

	require_once(uddeIMgetPath('absolute_path')."/administrator/components/com_uddeim/config.class.php");
	require_once(uddeIMgetPath('absolute_path')."/administrator/components/com_uddeim/admin.shared.php");
	require_once(uddeIMgetPath('absolute_path')."/administrator/components/com_uddeim/admin.includes.php");

	$mosConfig_locale = uddeIMgetLocale();
	$mosConfig_sitename = uddeIMgetSitename();
	$mosConfig_lang = uddeIMgetLang();
	$database = uddeIMgetDatabase();
	$version = uddeIMgetVersion();
	$pathtoadmin = uddeIMgetPath('admin');
	$pathtouser  = uddeIMgetPath('user');
	$config = new uddeimconfigclass();

	// set initial values
	$config->cryptkey = 'uddeIMcryptkey';
	$config->version = '2.4';
	$config->datumsformat = 'j M, H:i';
	$config->ldatumsformat = 'j F Y, H:i';
	$config->emn_sendermail = 'webmaster';
	$config->emn_sendername = 'Messaging';
	$config->sysm_username = '******';
	$config->charset = 'ISO-8859-1';
	$config->mailcharset = 'ISO-8859-1';
	$config->emn_body_nomessage = '';
	$config->emn_body_withmessage = '';
	$config->emn_forgetmenot = '';
	$config->export_format = '';
	$config->showtitle = '';
	$config->templatedir = 'default';
	$config->quotedivider= '__________';
	$config->blockgroups = '';
	$config->pubblockgroups = '';
	$config->hideusers = '62';
	$config->pubhideusers = '62';
	$config->attachmentgroups = '';
	$config->recaptchaprv = '';
	$config->recaptchapub = '';
	$config->allowedextensions = '';
	$config->badwords = '';
	$config->gravatard = '';
	$config->gravatarr = '';

	$config->ReadMessagesLifespan = 36524;
	$config->UnreadMessagesLifespan = 36524;
	$config->SentMessagesLifespan = 36524;
	$config->TrashLifespan = 2;
	$config->ReadMessagesLifespanNote = 0;
	$config->UnreadMessagesLifespanNote = 0;
	$config->SentMessagesLifespanNote = 0;
	$config->TrashLifespanNote = 1;
	$config->adminignitiononly = 1;
	$config->pmsimportdone = 0;
	$config->blockalert = 0;
	$config->blocksystem = 0;
	$config->allowemailnotify = 0;
	$config->notifydefault = 0;
	$config->popupdefault = 0;
	$config->allowsysgm = 0;
	$config->emailwithmessage = 0;
	$config->firstwordsinbox = 40;
	$config->longwaitingdays = 75;
	$config->longwaitingemail = 0;
	$config->maxlength = 2500;
	$config->showcblink = 1;
	$config->showcbpic = 1;
	$config->showonline = 1;
	$config->allowarchive = 0;
	$config->maxarchive = 100;
	$config->allowcopytome = 1;
	$config->trashoriginal = 1;
	$config->perpage = 8;
	$config->enabledownload = 0;
	$config->inboxlimit = 0;
	$config->showinboxlimit = 0;
	$config->allowpopup = 0;
	$config->allowbb = 1;
	$config->allowsmile = 1;
	$config->animated = 0;
	$config->animatedex = 0;
	$config->showmenuicons = 1;
	$config->bottomlineicons = 1;
	$config->actionicons = 1;
	$config->showconnex = 0;
	$config->showsettingslink = 2;
	$config->connex_listbox = 1;
	$config->forgetmenotstart = 0;
	$config->showabout = 0;
	$config->emailtrafficenabled = 0;
	$config->getpiclink = 0;
	$config->realnames = 0;
	$config->cryptmode = 0;
	$config->modeshowallusers = 1;
	$config->useautocomplete = 0;
	$config->allowmultipleuser = 1;
	$config->connexallowmultipleuser = 1;
	$config->allowmultiplerecipients = 1;
	$config->showtextcounter = 1;
	$config->allowforwards = 1;
	$config->showgroups = 0;
	$config->mailsystem = 0;
	$config->searchinstring = 1;
	$config->maxrecipients = 0;
	$config->languagecharset = 0;
	$config->usecaptcha = 0;
	$config->captchalen = 4;
	$config->pubfrontend = 0;
	$config->pubfrontenddefault = 0;
	$config->pubmodeshowallusers = 1;
	$config->hideallusers = 0;
	$config->pubhideallusers = 0;
	$config->unblockCBconnections = 1;
	$config->CBgallery = 0;
	$config->enablelists = 0;
	$config->maxonlists = 100;
	$config->timedelay = 0;
	$config->pubrealnames = 0;
	$config->pubreplies = 0;
	$config->pubemail = 0;
	$config->csrfprotection = 0;
	$config->trashrestriction = 0;
	$config->replytruncate = 0;
	$config->allowflagged = 0;
	$config->overwriteitemid = 0;
	$config->useitemid = 0;
	$config->timezone = 0;
	$config->pubsearchinstring = 1;
	$config->pubuseautocomplete = 0;
	$config->mootools = 1;
	$config->autoresponder = 0;
	$config->autoforward = 0;
	$config->rows = 10;
	$config->cols = 60;
	$config->width = 0;
	$config->enablefilter = 0;
	$config->enablereply = 0;
	$config->enablerss = 0;
	$config->showigoogle = 1;
	$config->showhelp = 0;
	$config->separator = 0;
	$config->rsslimit = 20;
	$config->restrictallusers = 0;
	$config->trashoriginalsent = 0;
	$config->checkbanned = 0;
	$config->enableattachment = 0;
	$config->maxsizeattachment = 16384;
	$config->maxattachments = 1;
	$config->fileadminignitiononly = 1;
	$config->showlistattachment = 1;
	$config->showmenucount = 0;
	$config->encodeheader = 0;
	$config->enablesort = 0;
	$config->captchatype = 0;
	$config->unprotectdownloads = 0;
	$config->waitdays = 0;
	$config->avatarw = 0;
	$config->avatarh = 0;
	$config->gravatar = 0;
	$config->addccline = 0;
	$config->modnewusers = 0;
	$config->modpubusers = 0;
	$config->restrictcon = 0;
	$config->restrictrem = 0;
	$config->stime = 0;
	$config->dontsefmsglink = 0;
	$config->enablepostbox = 0;
	$config->postboxfull = 0;
	$config->postboxavatars = 0;
	$config->replytext = 1;
	// temporary variables
	$config->flags = 0;
	$config->userid = 0;
	$config->usergid = 0;
	$config->cbitemid = 0;

	$config->languagecharset = 1;					// use UTF-8 on Joomla != 1.0

	// try to determine the best settings for uddeIM on this installation 
	// is uddeIM already installed and are messages in the archive?
	$sql="SELECT count(id) FROM #__uddeim WHERE archived=1";
	$database->setQuery($sql);
	$archivedmessages=$database->loadResult();
	$config->allowarchive = 0;
	$config->enabledownload = 0;
	if ($archivedmessages) {
		$config->allowarchive = 1;
		$config->enabledownload = 1;	
	}

	switch ($mosConfig_lang) {
		case "germani":
		case "germanf":
		case "german":
			$config->datumsformat = 'j M, H:i';
			$config->ldatumsformat = 'j. F Y, H:i';
			break;
		default:
			$config->datumsformat = 'j M, H:i';
			$config->ldatumsformat = 'j F Y, H:i';
			break;
	}

	// is CB installed? CB only, NOT CBE!
	$config->showcblink = 0;
	$config->showcbpic = 0;
	$config->showconnex = 0;
	$config->checkbanned = 0;
	$config->realnames = 0;
	if (uddeIMfileExists("/components/com_comprofiler/comprofiler.php")) {
		$config->showcblink = 1;
		$config->showcbpic = 1;
		$config->showconnex = 1;
		$config->checkbanned = 1;
		// now look for the CB config file
		// if realnames are used in CB, use realnames in uddeIM as well
		if (uddeIMfileExists("/administrator/components/com_comprofiler/ue_config.php")) {
			global $ueConfig;
			include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_comprofiler/ue_config.php");
			if (isset($ueConfig['name_format'])) {
				if ($ueConfig['name_format']=='1') {
					$config->realnames=1;
					$config->pubrealnames=1;
				}
			}
		}
	}
	if (uddeIMfileExists("/components/com_cbe/cbe.php")) {
		$config->showcblink = 4;
		$config->showcbpic = 4;
		$config->showconnex = 1;
		$config->checkbanned = 1;
		// now look for the CBE config file
		// if realnames are used in CBE, use realnames in uddeIM as well
		if (uddeIMfileExists("/administrator/components/com_cbe/ue_config.php")) {
			global $ueConfig;
			include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_cbe/ue_config.php");
			if (isset($ueConfig['name_format'])) {
				if ($ueConfig['name_format']=='1') {
					$config->realnames=1;
					$config->pubrealnames=1;
				}
			}
		}
	}
	if (uddeIMfileExists("/administrator/components/com_comprofiler/ue_config.php")) {
		global $ueConfig;
		include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_comprofiler/ue_config.php");
		if (isset($ueConfig['thumbWidth'])) {
			if ($ueConfig['thumbWidth'])
				$config->avatarw = (int)$ueConfig['thumbWidth'];
		}
		if (isset($ueConfig['thumbHeight'])) {
			if ($ueConfig['thumbHeight'])
				$config->avatarh = (int)$ueConfig['thumbHeight'];
		}
	} elseif (uddeIMfileExists("/administrator/components/com_cbe/ue_config.php")) {
		global $ueConfig;
		include_once(uddeIMgetPath('absolute_path')."/administrator/components/com_cbe/ue_config.php");
		if (isset($ueConfig['thumbWidth'])) {
			if ($ueConfig['thumbWidth'])
				$config->avatarw = (int)$ueConfig['thumbWidth'];
		}
		if (isset($ueConfig['thumbHeight'])) {
			if ($ueConfig['thumbHeight'])
				$config->avatarh = (int)$ueConfig['thumbHeight'];
		}
	}

	$postfix = "";
	if ($config->languagecharset)
		$postfix = ".utf8";
	// is the correct lang file installed?
	if (file_exists($pathtoadmin.'/language'.$postfix.'/'.$mosConfig_lang.'.php')) {
		include_once($pathtoadmin.'/language'.$postfix.'/'.$mosConfig_lang.'.php');
		$langinfo="";
	} elseif (file_exists($pathtoadmin.'/language'.$postfix.'/english.php')) {
		include_once($pathtoadmin.'/language'.$postfix.'/english.php');
		$langinfo="<p>There is no <b>".ucfirst($mosConfig_lang)." (UTF-8)</b> language file installed. uddeIM will use English (UTF-8).</p>";
	} elseif (file_exists($pathtoadmin.'/language/english.php')) {
		include_once($pathtoadmin.'/language/english.php');
		$langinfo="<p>There is no <b>".ucfirst($mosConfig_lang)."</b> language file installed. uddeIM will use English.</p>";
		$config->languagecharset=0;
	}

	// see http://www.iana.org/assignments/character-sets
	// http://www.w3.org/WAI/ER/IG/ert/iso639.htm
	// http://www.loc.gov/standards/iso639-2/php/code_list.php
	// en, fr_FR, es_ES, it_IT, pt_PT
	// http://code.elxis.org/20080/nav.html?includes/Core/locale.php.source.html
	$tag = strtolower(substr($mosConfig_locale,0,2));
	switch ($tag) {
		case "bg":
		case "ru":	
			$config->charset = 'cp1251';
			$config->mailcharset = 'Windows-1251';
			break;
		case "sr":
		case "vi":
		case "ar":	// and others
		case "el":	// and others
		case "sr":
		case "zh":	// and others
		case "ja":
			$config->charset = 'UTF-8';
			$config->mailcharset = 'UTF-8';
			break;
		default:
			$config->charset = 'ISO-8859-1';
			$config->mailcharset = 'ISO-8859-1';
			break;
	}
	if ($config->languagecharset==1) {
		$config->charset = 'UTF-8';
		$config->mailcharset = 'UTF-8';
	}

	// Now save these settings
	uddeIMsaveConfig($pathtoadmin, $config);

	// Now write a welcome message to the Admin
	$userid = uddeIMgetUserID();
	if ($userid) {
		if ($config->languagecharset) {			// UTF-8 fix, not tested so far
			$sql = "SET NAMES utf8;";
			$database->setQuery($sql);
			$isok = $database->query();
		}

		$rightnow = uddetime($config->timezone);
		$welcome_time = $rightnow;
		$welcome_user = "******";
		$welcome_msg = _UDDEADM_WELCOMEMSG;
		// its not a reply, so replyid=0
		$sql="INSERT INTO #__uddeim (fromid, toid, toread, message, datum, systemflag, disablereply, systemmessage, totrashoutbox, totrashdateoutbox) VALUES (".$userid.", ".$userid.", 0, '".$welcome_msg."', ".$welcome_time.", 1, 1, '".$welcome_user."', 1, ".$welcome_time.")";
		$database->setQuery($sql);
		if (!$database->query()) {
			die("SQL error when attempting to save a message" . $database->stderr(true));
		}	
	}

	// create folder for attachments
	$folder = "/images/uddeimfiles";
	if (!uddeIMfolderExists($folder)) {
		if (!uddeIMmkdir($folder)) {
			echo "<b><span style='color: red;'>"._UDDEADM_FOLDERCREATE_ERROR.$folder."</span></b>";
		} else {
			// uddeIMchmod($folder, "766");		// BUGBUG: Joomla send CHMOD instead of SITE CHMOD
			$file = $folder."/index.html";
			if (!uddeIMfileExists($file)) {
				$cf  = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n";
				$cf .= "<html><head></head><body></body></html>";
				uddeIMwriteFile($file, $cf);
			}

			$file = $folder."/.htaccess";
			if (!uddeIMfileExists($file)) {
				$cf  = "# Having a .htaccess prevents users from directly\n";
				$cf .= "# accessing the files in your /images/uddeimfiles folder\n";
				$cf .= "#\n";
				$cf .= "deny from all\n";
				uddeIMwriteFile($file, $cf);
			}
		}
	}
	
	echo "<div style='width: 600px; text-align: left;'>";
	echo "<p><b>"._UDDEADM_UDDEINSTCOMPLETE."</b></p>";
	echo $langinfo;
	echo "<p>"._UDDEADM_REVIEWSETTINGS."</p>";
	echo "<ul>";
	echo "<li>"._UDDEADM_REVIEWLANG."</li>";
	echo "<li>"._UDDEADM_REVIEWEMAILSTOP."</li>";
	echo "<li>"._UDDEADM_REVIEWUPDATE."</li>";
	$folder = "/uddeimfiles";
	if (uddeIMfolderExists($folder)) {
		echo "<li>"._UDDEADM_CHECKFILESFOLDER."</li>";
	}
	echo "</ul>";

	// redirect to settings
	echo "<p><a href='".uddeIMredirectIndex()."?option=com_uddeim'>".ucfirst(_UDDEADM_CONTINUE)."</a></p>";
	echo "</div>";
}
Пример #20
0
function uddeIMcheckForValidDB($option, $task, $uddeimversion, $config) {
	$database = uddeIMgetDatabase();

	$sql = "SHOW FIELDS FROM #__uddeim_userlists LIKE 'global';";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	if (!$rows)
		$rows = Array();
	$fields = Array();
	foreach ($rows as $row)
		$fields[]=$row->Field;
	if ( !in_array("global" , $fields) )
		return 0;	// it is 1.5 or below, since 1.6 has "global"

	$sql = "SHOW FIELDS FROM #__uddeim_spam LIKE 'mid';";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	if (!$rows)
		$rows = Array();
	$fields = Array();
	foreach ($rows as $row)
		$fields[]=$row->Field;
	if ( !in_array("mid" , $fields) )
		return 0;	// it is 1.6 or below, since 1.7 has "mid"

	$sql = "SHOW FIELDS FROM #__uddeim_emn LIKE 'locked';";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	if (!$rows)
		$rows = Array();
	$fields = Array();
	foreach ($rows as $row)
		$fields[]=$row->Field;
	if ( !in_array("locked" , $fields) )
		return 0;	// it is 1.6 or below, since 1.7 has "locked"

	$sql = "SHOW FIELDS FROM #__uddeim_attachments LIKE 'filename';";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	if (!$rows)
		$rows = Array();
	$fields = Array();
	foreach ($rows as $row)
		$fields[]=$row->Field;
	if ( !in_array("filename" , $fields) )
		return 0;	// it is 1.7 or 1.8, since 1.9 has "attachments"

	$sql = "SHOW FIELDS FROM #__uddeim LIKE 'systemflag';";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	if (!$rows)
		$rows = Array();
	$fields = Array();
	foreach ($rows as $row)
		$fields[]=$row->Field;
	if ( !in_array("systemflag" , $fields) )
		return 0;	// it is 1.9 or 2.0, since 2.1 has "systemflag"

	$sql = "SHOW FIELDS FROM #__uddeim LIKE 'delayed';";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	if (!$rows)
		$rows = Array();
	$fields = Array();
	foreach ($rows as $row)
		$fields[]=$row->Field;
	if ( !in_array("delayed" , $fields) )
		return 0;	// it is 2.2, since 2.3 has "delayed"

	return 1;
}