Esempio n. 1
0
 function cbLoginCheckJversion()
 {
     $udd_version = uddeIMgetVersion();
     if ($udd_version->PRODUCT == "Mambo") {
         if (strncasecmp($udd_version->RELEASE, "4.6", 3) < 0) {
             $udd_ver = 0;
         } else {
             $udd_ver = -1;
         }
     } elseif ($udd_version->PRODUCT == "Joomla!" || $udd_version->PRODUCT == "Accessible Joomla!") {
         if (strncasecmp($udd_version->RELEASE, "1.0", 3)) {
             $udd_ver = 1;
         } else {
             $udd_ver = 0;
         }
     }
     return $udd_ver;
 }
Esempio n. 2
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>";
}
Esempio n. 3
0
function uddeIMdoAutocomplete($config) {
	$pathtosite  = uddeIMgetPath('live_site');
	// 2007-11-21 zenny: added autocomplete feature. requires mootools, copyright etc. look this file's header
	// echo "<ul id='autocompleter-choices' class='autocompleter-choices' style='z-index: 42; visibility: hidden; opacity: 0;'></ul>";
	echo "<ul id='autocompleter-choices' class='autocompleter-choices' style='width: 200px; z-index: 42; visibility: hidden; opacity: 0;'></ul>";

	$version = uddeIMgetVersion();

	if ($config->mootools==1) { // auto

		if (class_exists('JHtml'))
			JHtml::_('behavior.framework', true);
		elseif (class_exists('JHTML'))
			JHTML::_('behavior.mootools');
		else
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/mootools.js");

		if (!strncasecmp($version->RELEASE, "1.0", 3) || 
			!strncasecmp($version->RELEASE, "1.5", 3)) {
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer.js");	// Joomla 1.0 and 1.5 uses old Observer class
			if ($config->searchinstring)
				uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter2.js");
			else
				uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.js");
		} else if (!strncasecmp($version->RELEASE, "1.6", 3) ||						// Joomla 1.6 uses new Observer class
				   !strncasecmp($version->RELEASE, "1.7", 3)) {						// Joomla 1.7 uses new Observer class
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer-1.2.js");
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter-1.2.js");
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.Request-1.2.js");
		} else {						// Joomla 2.5, 3.0 supports MooTools 1.3, so use MEIO
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Meio.Autocomplete.js");
		}

	} elseif ($config->mootools==2) { // MooTools 1.1

		uddeIMaddScript($pathtosite."/components/com_uddeim/js/mootools.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer.js");
		if ($config->searchinstring)
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter2.js");
		else
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.js");

	} elseif ($config->mootools==3) { // MooTools 1.2

		uddeIMaddScript($pathtosite."/components/com_uddeim/js/mootools-1.2.4-core.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer-1.2.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter-1.2.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.Request-1.2.js");

	} elseif ($config->mootools==4) { // do not load, assume MooTools 1.1

		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer.js");
		if ($config->searchinstring)
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter2.js");
		else
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.js");

	} elseif ($config->mootools==5) { // do not load, assume MooTools 1.2

		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer-1.2.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter-1.2.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.Request-1.2.js");

	} elseif ($config->mootools==6) { // do not load, use Meio.Autocomplete

		if (class_exists('JHtml'))
			JHtml::_('behavior.framework', true);
		elseif (class_exists('JHTML'))
			JHTML::_('behavior.mootools');
		// echo '<script src="'.$pathtosite."/components/com_uddeim/js/Meio.Autocomplete.js".'" type="text/javascript"></script>';
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Meio.Autocomplete.js");

	} elseif ($config->mootools==7) { // MooTools 1.3 + MEIO

		uddeIMaddScript($pathtosite."/components/com_uddeim/js/mootools-core-1.3-full-nocompat.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/mootools-more-1.3.0.1.js");
		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Meio.Autocomplete.js");

	} else {	// do not load MooTools, but we need the other classes (assume we have MooTools 1.11)

		uddeIMaddScript($pathtosite."/components/com_uddeim/js/Observer.js");
		if ($config->searchinstring)
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter2.js");
		else
			uddeIMaddScript($pathtosite."/components/com_uddeim/js/Autocompleter.js");

	}

	if (class_exists('JHtml'))		// J3.0+
		$completeURL = "index.php?option=com_uddeim&task=completeUserName&no_html=1&format=raw";
	elseif (class_exists('JHTML'))	// J1.5+
		$completeURL = "index.php?option=com_uddeim&task=completeUserName&no_html=1&format=raw";
	else
		$completeURL = "index2.php?option=com_uddeim&task=completeUserName&no_html=1";

	// <option value="7">force loading MooTools 1.3 (use MEIO)</option>
	// <option value="6">do not load MooTools (use MEIO)</option>
	// <option value="5">do not load MooTools (1.2 is used)</option>
	// <option value="4">do not load MooTools (1.1 is used)</option>
	// <option value="3">force loading MooTools 1.2</option>
	// <option value="2">force loading MooTools 1.1</option>
	// <option value="1">auto</option>
	// <option value="0">do not load MooTools</option>

	if ($config->mootools==0 || // assume MooTools 1.1
	   ($config->mootools==1 && !strncasecmp($version->RELEASE, "1.5", 3)) ||	// auto on J1.5 (MooTools 1.1)
	   ($config->mootools==1 && !strncasecmp($version->RELEASE, "1.0", 3)) ||	// auto on J1.0 (MooTools  1.1)
		$config->mootools==2 || // load MooTools 1.1
		$config->mootools==4) { // assume MooTools 1.1
	?>
		<script type="text/javascript">
		//<![CDATA[
			var inputElement = $('input_to_name');
			// var indicator = new Element('div').addClass('autocompleter-loading').setHTML('').setStyle('display', 'none').injectAfter( inputElement );
			var indicator = new Element('div', {'class': 'autocompleter-loading', 'styles': {'display': 'none'}}).setHTML('').injectAfter( inputElement );
			var completer = new Autocompleter.Ajax.Json( inputElement, '<?php echo $completeURL; ?>', {
					'customTarget': $('autocompleter-choices'),
					'onRequest': function(el) {
						indicator.setStyle('display', '');
					},
					'onComplete': function(el) {
						indicator.setStyle('display', 'none');
					},
					'injectChoice': function (choice, i) {
						// this is prepared to add more details
						// choice = unescape(choice);	- old style uddeIM 1.1
						// choice = decodeURI(choice);
						choice = decodeURIComponent(choice);
						var el = new Element('li').setHTML(this.markQueryValue(choice));
						el.inputValue = choice;
						this.addChoiceEvents(el).injectInside(this.choices);
					}
				});
		//]]>
		</script>
	<?php
	}

	if (($config->mootools==1 && !strncasecmp($version->RELEASE, "1.6", 3)) || 
		($config->mootools==1 && !strncasecmp($version->RELEASE, "1.7", 3)) || // auto on J1.6 (its MooTools 1.2)
		 $config->mootools==3 || // load MooTools 1.2
		 $config->mootools==5) { // assume MooTools 1.2
		$sep=",";
		if ($config->separator==1)
			$sep=";";
	?>
		<script type="text/javascript">
		//<![CDATA[
			var inputElement = $('input_to_name');
			var indicator = new Element('div', {'class': 'autocompleter-loading', 'styles': {'display': 'none'}}).injectAfter( inputElement );
			var completer = new Autocompleter.Request.JSON( inputElement, '<?php echo $completeURL; ?>', {
					'customChoices': $('autocompleter-choices'),
					'onRequest': function(el) {
						indicator.setStyle('display', '');
					},
					'onComplete': function(el) {
						indicator.setStyle('display', 'none');
					},
					'multiple': true,
					'postVar': 'value',
					<?php
					if ($config->searchinstring) echo "'filterSubset': true,";
					?>
					'separator': '<?php echo $sep; ?>',
					'autoTrim': true,
					'width': 'inherit',
					'injectChoice': function (token, i) {
						// token = decodeURI(token);
						token = decodeURIComponent(token);
						var el = new Element('li', {'html': this.markQueryValue(token)});
						el.inputValue = token;
						this.addChoiceEvents(el).injectInside(this.choices);
					}
				});
		//]]>
		</script>
	<?php
	}

	if (($config->mootools==1 && !strncasecmp($version->RELEASE, "2.5", 3)) || // on Joomla 2.5 use Meio because of MooTools 1.4
		($config->mootools==1 && !strncasecmp($version->RELEASE, "3.0", 3)) || // on Joomla 3.0 use Meio because of MooTools 1.4
		($config->mootools==1 && !strncasecmp($version->RELEASE, "3.1", 3)) || // on Joomla 3.0 use Meio because of MooTools 1.4
		($config->mootools==1 && !strncasecmp($version->RELEASE, "3.2", 3)) || // on Joomla 3.0 use Meio because of MooTools 1.4
		 $config->mootools==6 || // Joomla 2.5 supports MooTools 1.3, so use MEIO
		 $config->mootools==7) { // assume MooTools, use Meio
		$sep=",";
		if ($config->separator==1)
			$sep=";";
//		<input id="value-field" type="text" />
//				valueField: $('value-field'),
//				valueFilter: function(data){
//					return data.identifier;
//				},
	?>
		<script type="text/javascript">
		//<![CDATA[
			var Utf8 = {
				/** http://www.webtoolkit.info **/
				encode : function (string) {
					string = string.replace(/\r\n/g,"\n");
					var utftext = "";
					for (var n = 0; n < string.length; n++) {
						var c = string.charCodeAt(n);
						if (c < 128) {
							utftext += String.fromCharCode(c);
						}
						else if((c > 127) && (c < 2048)) {
							utftext += String.fromCharCode((c >> 6) | 192);
							utftext += String.fromCharCode((c & 63) | 128);
						}
						else {
							utftext += String.fromCharCode((c >> 12) | 224);
							utftext += String.fromCharCode(((c >> 6) & 63) | 128);
							utftext += String.fromCharCode((c & 63) | 128);
						}
					}
					return utftext;
				},
				decode : function (utftext) {
					var string = "";
					var i = 0;
					var c = c1 = c2 = 0;
					while ( i < utftext.length ) {
						c = utftext.charCodeAt(i);
						if (c < 128) {
							string += String.fromCharCode(c);
							i++;
						}
						else if((c > 191) && (c < 224)) {
							c2 = utftext.charCodeAt(i+1);
							string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
							i += 2;
						}
						else {
							c2 = utftext.charCodeAt(i+1);
							c3 = utftext.charCodeAt(i+2);
							string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
							i += 3;
						}
					}
					return string;
				}
			}
			var data = [
				{identifier: 0, value: 'dummy'}
			];
			new Meio.Autocomplete.Select('input_to_name', '<?php echo $completeURL; ?>', {
				delay: 200,
				minChars: 0,
				selectOnTab: true, 
				maxVisibleItems: 10,
				filter: {
					filter: function(text, data){ return true; }, // filters the data array
<?php
			if ($config->charset=="UTF-8") {
?>
					formatMatch: function(text, data, i){ return decodeURIComponent(data); }, // this function should return the text value of the data element
					formatItem: function(text, data){ return decodeURIComponent(data); } // the return of this function will be applied to the 'html' of the li's
<?php
			} else {
?>
					formatMatch: function(text, data, i){ return Utf8.decode(decodeURIComponent(data)); }, // this function should return the text value of the data element
					formatItem: function(text, data){ return Utf8.decode(decodeURIComponent(data)); } // the return of this function will be applied to the 'html' of the li's
<?php
			}
?>
				}, 				
				requestOptions: {
					data: {'json': JSON.encode(data)},
					noCache: true
					// you can pass any of the Request.JSON options here -> http://mootools.net/docs/core/Request/Request.JSON
				},
				urlOptions: {
					queryVarName: 'value',	// the name of the variable that's going to the server with the query value inputed by the user.
					extraParams: null,
					max: 20					// the max number of options that should be listed. This will be sent to the ajax request as the 'limit' parameter.
				} 
			});
		//]]>
		</script>
	<?php
	}
}
Esempio n. 4
0
function uddeIMcheckJversion() {					// borrowed from Cummunity Builder, -1 = Mambo>=4.6, 0 = Mambo <=4.5/J1.0, 1 = J1.5
	// API version:
	// =0 = mambo 4.5.0-4.5.3+Joomla 1.0.x
	// =1 = Joomla! 1.5
	// =2 = Joomla! 1.6
	// =3 = Joomla! 1.7
	// =4 = Joomla! 2.5
	// =5 = Joomla! 3
	// =6 = Joomla! 3.1
	// =7 = Joomla! 3.2
	// =8 = Joomla! 3.3
	// >2 = newer ones: maybe compatible
	// <0 = -1: Mambo 4.6
	
    // $db = JFactory::getDBO();         
    // $version = new JVersion;
    // $joomla = $version->getShortVersion();
    // if(substr($joomla,0,3) == '1.6'){
        //Joomla 1.6 code
    // } else {
        //Joomla 1.0/1.5 code
    // }
	
	$version = uddeIMgetVersion();
	if ($version->PRODUCT == "Mambo") {
		if ( strncasecmp( $version->RELEASE, "4.6", 3 ) < 0 ) {
			$ver = 0;
		} else {
			$ver = -1;
		}
	} elseif ($version->PRODUCT == "Elxis") {
		$ver = 0;
	} elseif ($version->PRODUCT == "MiaCMS") {
		$ver = -1;
	} elseif ($version->PRODUCT == "Joomla!" || $version->PRODUCT == "Accessible Joomla!") {
		if (!strncasecmp($version->RELEASE, "1.0", 3)) {
			$ver = 0;
		} elseif (!strncasecmp($version->RELEASE, "1.5", 3)) {
			$ver = 1;
		} elseif (!strncasecmp($version->RELEASE, "1.6", 3)) {
			$ver = 2;
		} elseif (!strncasecmp($version->RELEASE, "1.7", 3)) {
			$ver = 3;
		} elseif (!strncasecmp($version->RELEASE, "2.5", 3)) {
			$ver = 4;
		} elseif (!strncasecmp($version->RELEASE, "3.0", 3)) {
			$ver = 5;
		} elseif (!strncasecmp($version->RELEASE, "3.1", 3)) {
			$ver = 6;
		} elseif (!strncasecmp($version->RELEASE, "3.2", 3)) {
			$ver = 7;
		} elseif (!strncasecmp($version->RELEASE, "3.3", 3)) {
			$ver = 8;
		} else {
			$ver = 9;
		}
	} else {
		$ver = 0;
	}
	return $ver;
}
Esempio n. 5
0
	// load the css file
	$css = "";
	if(file_exists($pathtouser.'/templates/'.$config->templatedir.'/css/uddeim'.$css_appendix.'.css')) {
		$css = $pathtosite."/components/com_uddeim/templates/".$config->templatedir."/css/uddeim".$css_appendix.".css";
	} elseif(file_exists($pathtouser.'/templates/'.$config->templatedir.'/css/uddeim'.$css_alternative.'.css')) {
		$css = $pathtosite."/components/com_uddeim/templates/".$config->templatedir."/css/uddeim".$css_alternative.".css";
	} elseif(file_exists($pathtouser.'/templates/'.$config->templatedir.'/css/uddeim.css')) {
		$css = $pathtosite."/components/com_uddeim/templates/".$config->templatedir."/css/uddeim.css";
	} else {
		// template css doesn't exist, now we try to load the default css file
		if(file_exists($pathtouser.'/templates/default/css/uddeim.css'))
			$css = $pathtosite."/components/com_uddeim/templates/default/css/uddeim.css";
	}
	uddeIMaddCSS($css);

	$version = uddeIMgetVersion();
	if ($config->useautocomplete) {
		if (($config->mootools==1 && !strncasecmp($version->RELEASE, "1.0", 3)) ||
			($config->mootools==1 && !strncasecmp($version->RELEASE, "1.5", 3)) ||
			($config->mootools==1 && !strncasecmp($version->RELEASE, "1.6", 3)) ||
			($config->mootools==1 && !strncasecmp($version->RELEASE, "1.7", 3)) ||
			 $config->mootools==0 ||
			 $config->mootools==2 ||
			 $config->mootools==3 ||
			 $config->mootools==4 ||
			 $config->mootools==5) {
			$css = "";
			if(file_exists($pathtouser.'/templates/'.$config->templatedir.'/css/autocompleter'.$css_appendix.'.css')) {
				$css = $pathtosite."/components/com_uddeim/templates/".$config->templatedir."/css/autocompleter".$css_appendix.".css";
			} elseif(file_exists($pathtouser.'/templates/'.$config->templatedir.'/css/autocompleter'.$css_alternative.'.css')) {
				$css = $pathtosite."/components/com_uddeim/templates/".$config->templatedir."/css/autocompleter".$css_alternative.".css";
Esempio n. 6
0
function uddeIMshowMCP($option, $task, $act, $config) {
	$mosConfig_offset = uddeIMgetOffset();
	$database = uddeIMgetDatabase();
	$version = uddeIMgetVersion();
	$emnid = intval( uddeIMmosGetParam( $_POST, 'id', '' ) );
	
	uddeIMaddScript(uddeIMgetPath('live_site')."/components/com_uddeim/js/uddeimtools.js");

	switch($act) {
		case "delete":	uddeIMdeleteOneMessage($option, $task, $act, $emnid, $config);		break;
		case "deliver":	uddeIMdeleteOneMessage($option, $task, $act, $emnid, $config);		break;
	}

	// get parameter from filter
	$f_param = array();
	$f_where = array();

	$f_param[0] = uddeIMmosGetParam($_POST, 'f_username', '');
	if($f_param[0]!="") $f_where[] = "ufrom.username LIKE '$f_param[0]%'";

	$f_param[1] = uddeIMmosGetParam($_POST, 'f_name', '');
	if($f_param[1]!="") $f_where[] = "ufrom.name LIKE '$f_param[1]%'";

	$limit      = intval( uddeIMmosGetParam( $_POST, 'limit', 10 ) );
	$limitstart = intval( uddeIMmosGetParam( $_POST, 'limitstart', 0 ) );
	$where = count($f_where) ? " WHERE `delayed`<>0 " . implode(' AND ', $f_where) : " WHERE `delayed`<>0";

	$sql  = "SELECT count(id) FROM #__uddeim".$where;
	$database->setQuery($sql);
	$total = (int)$database->loadResult();
	if ($limit==0) {
		$limit = $total;
		$limitstart = 0;
	}
	if ($limitstart>=$total)
		$limitstart = 0;

// echo($sql." ==> ".$total."<br />");

	$sql  = "SELECT a.totrash AS trashinbox, a.totrashoutbox AS trashoutbox, a.*, ufrom.name AS fromname, 
						   uto.name AS toname,
						 ufrom.username AS fromusername, 
						   uto.username AS tousername,
						       ufrom.id AS fromid,
						         uto.id AS toid
				FROM ((#__uddeim AS a LEFT JOIN #__users AS ufrom ON a.fromid = ufrom.id) 
							         LEFT JOIN #__users AS uto   ON a.toid   = uto.id)";
	$sql .= $where;
	$sql .= " ORDER BY a.id DESC LIMIT $limitstart,$limit";
	$database->setQuery($sql);
	$rows = $database->loadObjectList();
	
	// echo($sql."<br />");

	// include_once(uddeIMgetPath('absolute_path')."/administrator/includes/pageNavigation.php");
	$pageNav = new uddeIMmosPageNav( $total, $limitstart, $limit  );

	$query="SELECT username,name FROM #__users WHERE block!='1' ORDER BY username";
	$database->setQuery($query);
	$results = $database->loadObjectList();

	$results = array("a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");
	
	$the_username='******';
	if ($f_param[0]=="") $the_username.=' selected';
	$the_username.='>'._UDDEADM_USERSET_SELUSERNAME.'</option>';
	foreach($results as $result) {
		$the_username.='<option value="'.$result.'"';
		if ($result==$f_param[0]) $the_username.=' selected';
		$the_username.='>'.$result.'...</option>';
	}
	$the_username.="</select>";

	$the_name='<select id="f_name" class="text" name="f_name" size="1"><option value=""';
	if ($f_param[1]=="") $the_name.=' selected';
	$the_name.='>'._UDDEADM_USERSET_SELNAME.'</option>';
	foreach($results as $result) {
		$the_name.='<option value="'.$result.'"';
		if ($result==$f_param[1]) $the_name.=' selected';
		$the_name.='>'.$result.'...</option>';
	}
	$the_name.="</select>";

//			<h4><img align="middle" style="display: inline;" src="<?php echo uddeIMgetPath('live_site')."/administrator/images/inbox.png";          " />&nbsp;<?php echo _UDDEADM_MCP_EDIT;               </h4>
    ?>
    <form action="<?php echo uddeIMredirectIndex(); ?>" method="post" name="adminForm" id='adminForm'>

	<div align="center">
    <table cellpadding="4" cellspacing="0" border="0" width="98%">
	<tr>
		<td class="sectionname" align="left">
			<h4><?php echo _UDDEADM_MCP_EDIT; ?></h4>
		</td>
		<td class="sectionname" align="right">
			<img align="middle" style="display: inline; border:1px solid lightgray;" src="<?php echo uddeIMgetPath('live_site')."/components/com_uddeim/templates/images/uddeim_logo.png"; ?>" />
		</td>
	</tr>
	</table>
	</div>

	<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist">
	<tr>
		<td width="100%" align="left"><?php echo $pageNav->writeLimitBox('?option=$option&task=$task'); ?></td>
		<td><?php echo $the_username; ?></td>
		<td><?php echo $the_name; ?></td>
		<td>
			<input type="submit" value="<?php echo _UDDEADM_ADMIN_FILTER; ?>" />
		</td>
	</tr>
	</table>

	<br />

	<table class="adminlist">
	<tr>
		<th class="title" width="4%"><input type="checkbox" name="toggle" value="" onclick="checkAll(<?php echo count( $rows ); ?>);" /></th>
		<th class="title" width="4%"><?php echo "ID"; ?></th>
		<th class="title" width="4%"><?php echo _UDDEADM_MCP_TRASHED; ?></th>
		<th class="title" nowrap="nowrap"><?php echo _UDDEADM_MCP_FROM; ?></th>
		<th class="title" width="4%"><?php echo _UDDEADM_MCP_TRASHED; ?></th>
		<th class="title" nowrap="nowrap"><?php echo _UDDEADM_MCP_TO; ?></th>
		<th class="title"><?php echo _UDDEADM_MCP_DELIVER; ?></th>
		<th class="title"><?php echo _UDDEADM_MCP_DELETE; ?></th>
		<th class="title" nowrap="nowrap"><?php echo _UDDEADM_MCP_DATE; ?></th>
	</tr>
<?php
	$k = 0;
	for($i=0, $n=count( $rows ); $i < $n; $i++)
	{
		$row = &$rows[$i];
		echo "<tr class='row$k'>";
		echo "<td width='5%'><input type='checkbox' id='cb$i' name='uddeid[]' value='$row->id' onclick='isChecked(this.checked);' /></td>";
		echo "<td align='left'>$row->id</td>";
		echo "<td align='left'>";
			echo uddeIMshowValueNULL($row->trashoutbox);
		echo "</td>";
		echo "<td align='left'>";
			if ($row->fromid)
				echo "Public: $row->fromname ($row->fromusername)";
			else
				echo "$row->publicname ($row->publicemail)";
		echo "</td>";
		echo "<td align='left'>";
			echo uddeIMshowValueNULL($row->trashinbox);
		echo "</td>";
		echo "<td align='left'>";
			echo "$row->toname ($row->tousername)";
		echo "</td>";
		echo "<td align='left'>";
			if ($row->delayed) {
				echo "<a href='#' onclick='document.adminForm.act.value=\"deliver\"; document.adminForm.id.value=\"".$row->id."\"; if (confirm(\""._UDDEADM_MCP_NOTEDELIVER."\")) document.adminForm.submit(); return false;'>";
				uddeIMshowTick(true,false);		// show tick, opaque (false)
				echo "</a>";
			} else {
				uddeIMshowTick(false,true);		// show cross, opaque (false)
			}
		echo "</td>";
		echo "<td align='left'>";
			if (is_null($row->trashoutbox) && is_null($row->trashinbox)) {
				// message already deleted
			} else {
				echo "<a href='#' onclick='document.adminForm.act.value=\"delete\"; document.adminForm.id.value=\"".$row->id."\"; if (confirm(\""._UDDEADM_MCP_NOTEDEL."\")) document.adminForm.submit(); return false;'>";
				uddeIMshowTick(false,($row->trashoutbox && $row->trashinbox));	// show cross, not opaque (opaque, wenn beide true)
				echo "</a>";
			}
		echo "</td>";
		echo "<td align='left'>";
			echo date("Y-m-d H:i:s", $row->datum + (3600*uddeIMgetUserTZ()));
		echo "</td>";
		echo "</tr>\n";
		
		echo "<tr class='row$k'>";
		echo "<td align='left'></td>";
		echo "<td align='left'></td>";
		echo "<td align='left' colspan='7'>";
			echo "<div style='text-align:right;'><a href='javascript:uddeIMtoggleLayer(\"".$i."\");'>"._UDDEADM_MCP_SHOWHIDE."</a></div>";
			echo "<div id='uddeimdivlayer_".$i."' style='display:none;'>";
			// $dm = uddeIMdecrypt($row->message, "", $row->cryptmode);
			$dm = uddeIMgetMessage($row->message, "", $row->cryptmode, $row->crypthash, $config->cryptkey);
			echo $dm;
			echo "</div>";
		echo "</td>";
		echo "</tr>\n";

		$k = 1 - $k;
	}
?>
<tr>
	<th align="center" colspan="9"><?php echo $pageNav->writePagesLinks(); ?></th>
</tr>
<tr>
	<td align="center" colspan="9"><?php echo $pageNav->writePagesCounter(); ?></td>
</tr>
</table>
	<input type="hidden" name="option" value="<?php echo $option;?>" />
	<input type="hidden" name="task" value="<?php echo $task;?>" />
	<input type="hidden" name="act" value="" />
	<input type="hidden" name="id" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="hidemainmenu" value="0" />
<?php
	if ($version->PRODUCT == "Joomla!" || $version->PRODUCT == "Accessible Joomla!")
		if (strncasecmp($version->RELEASE, "1.0", 3)) {
			echo "<input type=\"hidden\" name=\"limitstart\" value=\"".(int)$limitstart."\" />";
		}
?>
</form>
<?php
}