示例#1
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>";
}
示例#2
0
function uddeIMarrowReplace($shownav, $templatedir) {
	$pathtosite  = uddeIMgetPath('live_site');

	if(uddeIMfileExists('/components/com_uddeim/templates/'.$templatedir.'/images/icon_end.gif')) {
		$shownav=str_replace("&raquo;",  "<img src='".$pathtosite."/components/com_uddeim/templates/".$templatedir."/images/icon_end.gif' border='0' alt='' />", $shownav);
		$shownav=str_replace("&gt;&gt;", "<img src='".$pathtosite."/components/com_uddeim/templates/".$templatedir."/images/icon_end.gif' border='0' alt='' />", $shownav);
	}
	if(uddeIMfileExists('/components/com_uddeim/templates/'.$templatedir.'/images/icon_start.gif')) {
		$shownav=str_replace("&laquo;",  "<img src='".$pathtosite."/components/com_uddeim/templates/".$templatedir."/images/icon_start.gif' border='0' alt='' />", $shownav);
		$shownav=str_replace("&lt;&lt;", "<img src='".$pathtosite."/components/com_uddeim/templates/".$templatedir."/images/icon_start.gif' border='0' alt='' />", $shownav);
	}
	if(uddeIMfileExists('/components/com_uddeim/templates/'.$templatedir.'/images/icon_prev.gif')) {
		$shownav=str_replace("&lt;", "<img src='".$pathtosite."/components/com_uddeim/templates/".$templatedir."/images/icon_prev.gif' border='0' alt='' />", $shownav);
	}
	if(uddeIMfileExists('/components/com_uddeim/templates/'.$templatedir.'/images/icon_next.gif')) {
		$shownav=str_replace("&gt;", "<img src='".$pathtosite."/components/com_uddeim/templates/".$templatedir."/images/icon_next.gif' border='0' alt='' />", $shownav);
	}
	return $shownav;
}
示例#3
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;
}
示例#4
0
function uddeIMcheckAUP() {
	return uddeIMfileExists("/components/com_alphauserpoints/helper.php");
}
示例#5
0
function uddeIMconvertConfiguration($option, $task, $pathtoadmin, $expectedversion, $config) {
	$database = uddeIMgetDatabase();
	echo "<p><span style='color: red;'>"._UDDEADM_CFGFILE_NOTFOUND."<br /><br />"._UDDEADM_CFGFILE_FOUND." ".$config->version."<br />"._UDDEADM_CFGFILE_EXPECTED." ".$expectedversion."</span></p>\n"; 
	echo "<p>"._UDDEADM_CFGFILE_CONVERTING."</p>";

	echo "<p>";
	if ($config->version<="0.9") {
		echo _UDDEADM_CFGFILE_CONVERTING_1."<br />";
		$config->mootools = 1;
	}
	if ($config->version<="1.0") {
		echo _UDDEADM_CFGFILE_CONVERTING_2."<br />";
		$config->autoresponder = 0;
		$config->autoforward = 0;
		$config->rows = 10;
		$config->cols = 60;
		$config->width = 0;
		$config->enablefilter = 0;
		$config->enablereply = 0;
	}
	if ($config->version<="1.1") {
		echo _UDDEADM_CFGFILE_CONVERTING_3."<br />";
		$config->enablerss = 0;
		$config->showigoogle = 1;
		$config->showhelp = 0;
		$config->separator = 0;
		$config->rsslimit = 20;
		$config->restrictallusers = 0;
	}
	if ($config->version<="1.2") {
		echo _UDDEADM_CFGFILE_CONVERTING_4."<br />";
		$config->trashoriginalsent = 0;
		$config->reportspam = 0;
		$config->checkbanned = 0;
	}
	if ($config->version<="1.3") {
		echo _UDDEADM_CFGFILE_CONVERTING_5."<br />";
		$config->enableattachment = 0;
		$config->maxsizeattachment = 16384;
		$config->maxattachments = 1;
		$config->attachmentgroups = '';
		$config->fileadminignitiononly = 1;
		$config->showlistattachment = 1;
		$config->showmenucount = 0;
		$config->encodeheader = 0;
		$config->enablesort = 0;
	}
	if ($config->version<="1.4") {
		echo _UDDEADM_CFGFILE_CONVERTING_6."<br />";
		$config->captchatype = 0;
		$config->recaptchaprv = 'private-key';
		$config->recaptchapub = 'public-key';
	}
	if ($config->version<="1.5") {
		echo _UDDEADM_CFGFILE_CONVERTING_7."<br />";
		$config->unprotectdownloads = 0;
		$config->waitdays = 0;
		$config->allowedextensions = "";
		$config->pubemail = 0;
	}
	if ($config->version<="1.6") {
		echo _UDDEADM_CFGFILE_CONVERTING_8."<br />";
		$config->avatarw = 0;
		$config->avatarh = 0;
		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'];
			}
		}
		$config->gravatar = 0;
		$config->gravatard = '';
		$config->gravatarr = 'g';
	}
	if ($config->version<="1.8") {
		echo _UDDEADM_CFGFILE_CONVERTING_9."<br />";
		$config->addccline = 0;
		$config->modnewusers = 0;
		$config->modpubusers = 0;
	}
	if ($config->version<="1.9") {
		echo _UDDEADM_CFGFILE_CONVERTING_10."<br />";
		$config->restrictcon = 0;
		$config->restrictrem = 0;
		$config->stime = 0;
		$config->dontsefmsglink = 0;
	}
	if ($config->version<="2.0") {
		echo _UDDEADM_CFGFILE_CONVERTING_11."<br />";
		$config->enablebostbox = 0;
	}
	if ($config->version<="2.1") {
		echo _UDDEADM_CFGFILE_CONVERTING_12."<br />";
		$config->enablebostbox = 0;
		$config->postboxfull = 0;
		$config->postboxavatars = 0;
	}
	if ($config->version<="2.2") {
		echo _UDDEADM_CFGFILE_CONVERTING_13."<br />";
		$config->replytext = 1;
	}
	if ($config->version<="2.3") {
		echo _UDDEADM_CFGFILE_CONVERTING_14."<br />";
		$config->badwords = "";
	}
	if ($config->version<="2.4") {
		echo _UDDEADM_CFGFILE_CONVERTING_15."<br />";
		$config->groupsadmin = "";
		$config->groupsspecial = "";
	}	
	if ($config->version<="2.5") {
		echo _UDDEADM_CFGFILE_CONVERTING_16."<br />";
		$config->showmenulink = 0;
	}

	echo "</p>";

	// do the converting here
	if (uddeIMsaveConfig($pathtoadmin, $config))
		echo "<p>"._UDDEADM_CFGFILE_DONE."</p>";
	echo "<p><b><a href=".uddeIMredirectIndex()."?option=com_uddeim>"._UDDEADM_CONTINUE."</a></b></p>";
}