\n";
}
}
if ( trim( $text_edit_profile ) ) {
if ( ! ( ( $compact && ( $show_remind_register_icons == 2 ) ) || $horizontal ) ) {
if ($avatar_position=="default") {
echo '
';
} else {
echo '
\n";
}
}
if ( !$horizontal ) {
$preDiv = '
'
. '
\n";
}
if ( $show_avatar and ($avatar_position!="default") and ($greeting) ) {
if ($avatarDisplayed && ( ! $horizontal ) ) {
echo $preDiv . '" id="mod_login_greeting'.$id_sfx.'">';
echo '
';
echo $cbUser->replaceUserVars(sprintf( _UE_HI_NAME, '
'.$name ));
echo $postDiv;
} else {
echo '
'.$cbUser->replaceUserVars(sprintf( _UE_HI_NAME, $name )).'';
}
}
$pms = 0;
if($show_pms != 0) {
$pms = $pms_type; // RC2 quick fix
if($pms != 0)
{
if ( class_exists( 'moscomprofilerUser', false ) ) {
$viewLevels = CBuser::getMyInstance()->getAuthorisedViewLevelsIds( ( checkJversion() >= 2 ? false : true ) );
} else {
// Compute View Level using CMS without loading cb.table and cb.database if they are not already loaded (e.g. when using this function in modules):
if ( checkJversion() >= 2 ) {
$viewLevels = JUser::getInstance()->getAuthorisedViewLevels();
} else {
$viewLevels = range( 0, $_CB_framework->myCmsGid() );
}
}
$cleanedANDpubAccess = ' AND published = 1 AND access IN (' . implode( ',', cbArrayToInts( $viewLevels ) ) . ')';
if ( checkJversion() >= 2 ) {
$cleanedANDpubAccess .= ' AND ' . $_CB_database->NameQuote( 'language' ) . ' IN ( ' . $_CB_database->Quote( $_CB_framework->getCfg( 'lang_tag' ) ) . ', ' . $_CB_database->Quote( '*' ) . ', ' . $_CB_database->Quote( '' ) . ' )';
}
switch ($pms) {
case 1:
$pmsnameprefix = "";
$query_pms_count = "SELECT count(id) FROM #__".$pmsnameprefix."pms WHERE username=" . $_CB_database->Quote( $_CB_framework->myUsername() ) . " AND readstate=0";
$_CB_database->setQuery( $query_pms_count );
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."pms%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix."pms&page=index".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 2:
$pmsnameprefix = "my";
$query_pms_count = "SELECT count(id) FROM #__".$pmsnameprefix."pms WHERE username=" . $_CB_database->Quote( $_CB_framework->myUsername() ) . " AND readstate=0";
$_CB_database->setQuery( $query_pms_count );
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."pms%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix."pms&task=inbox".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 3:
$query_pms_count="SELECT count(u.id) FROM #__uddeim AS u WHERE u.totrash=0 AND u.toread=0 AND u.toid=" . (int) $_CB_framework->myId();
$_CB_database->setQuery($query_pms_count);
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_uddeim%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_uddeim&task=inbox".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 4: // PMS Enhanced by Stefan:
$pmsnameprefix = "";
$query_pms_count = "SELECT count(id) FROM #__".$pmsnameprefix."pms WHERE username=" . $_CB_database->Quote( $_CB_framework->myUsername() ) . " AND readstate=0 AND inbox=1";
$_CB_database->setQuery( $query_pms_count );
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."pms%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix."pms&page=inbox".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 5: // Clexus:
$pmsnameprefix = "my";
$query_pms_count = "SELECT count(id) FROM #__".$pmsnameprefix."pms WHERE userid='" . (int) $_CB_framework->myId() . "' AND readstate=0";
$_CB_database->setQuery( $query_pms_count );
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."pms%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix."pms&task=inbox".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 6: // PMS Enhanced 2.x by Stefan:
$pmsnameprefix = "";
$query_pms_count = "SELECT count(id) FROM #__".$pmsnameprefix."pms WHERE recip_id=" . (int) $_CB_framework->myId() . " AND readstate%2=0 AND inbox=1";
$_CB_database->setQuery( $query_pms_count );
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."pms%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix."pms&page=inbox".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 7:
$pmsnameprefix="missus";
$query_pms_count = "SELECT COUNT(*) FROM #__missus AS m JOIN #__missus_receipt AS r WHERE m.id=r.id AND r.receptorid='" . (int) $_CB_framework->myId() . "' AND r.rptr_rstate=0 AND r.rptr_tstate=0 AND r.rptr_dstate=0 AND m.is_draft=0";
$_CB_database->setQuery( $query_pms_count );
$total_pms = $_CB_database->loadResult();
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix."&func=showinbox".($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 8:
$pmsnameprefix="jim";
$query_pms_count = "SELECT COUNT(id) FROM #__jim WHERE username=" . $_CB_database->Quote( $_CB_framework->myUsername() ) . " AND readstate=0";
$_CB_database->setQuery( $query_pms_count );
$total_pms = intval($_CB_database->loadResult());
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix.($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 9:
$pmsnameprefix="primezilla";
$query_pms_count = "SELECT COUNT(*) FROM #__primezilla_inbox WHERE userid=" . (int) $_CB_framework->myId() . " AND flag_read=0 AND flag_deleted=0";
$_CB_database->setQuery( $query_pms_count );
$total_pms = intval($_CB_database->loadResult());
$query_pms_link = "SELECT id FROM #__menu WHERE link LIKE '%com_".$pmsnameprefix."%'" . $cleanedANDpubAccess;
$_CB_database->setQuery( $query_pms_link );
$pms_link_id = $_CB_database->loadResult();
$pms_link = "index.php?option=com_".$pmsnameprefix.($pms_link_id ? "&Itemid=".$pms_link_id : "");
break;
case 10: // JAM (Joomla Advanced Message), J1.5 only:
// Amount unread messages:
$query = 'SELECT COUNT(id)'
. ' FROM `#__jam_receivers`'
. ' WHERE rid = ' . (int) $_CB_framework->myId() . ' AND inbox = 1 AND state = 0';
$_CB_database->setQuery( $query );
$total_pms = $_CB_database->loadResult();
// JAM url:
if ( $jVersion == 1 ) {
$menu =& JSite::getMenu();
$item = $menu->getItems( 'link', 'index.php?option=com_jam&view=inbox', true);
} else {
$item = false;
}
if ( $item ) {
$pms_link = 'index.php?Itemid=' . $item->id;
} else {
$pms_link = 'index.php?option=com_jam&view=inbox';
}
break;
/* Test-code for SMF PMS integration: to be validated with SMF team before integration !
case xxx:
global $user_info;
$total_pms = $user_info['unread_messages'];
$pms_link = ???
*/
default:
break;
}
$pmsMsg = "";
if (($total_pms) > 0 ) {
$pmsMsg .= '
';
$pmsMsg .= '
'.( $horizontal ? " \n" : "
\n" );
$pmsMsg .= '
';
$pmsMsg .= ''._UE_PM_MESSAGES_HAVE." ".$total_pms." ".($total_pms == 1 ? _UE_PM_NEW_MESSAGE : _UE_PM_NEW_MESSAGES)."\n";
} else {
if($show_pms >= 2 ) {
$pmsMsg .= '
';
$pmsMsg .= ''._UE_PM_NO_MESSAGES."\n";
}
}
if ($pmsMsg) {
if ( !$horizontal ) echo $preDiv.' margin-top:0.7em;" id="mod_login_pms'.$id_sfx.'">';
echo $pmsMsg;
if ( !$horizontal ) echo $postDiv;
}
}
}
if($showPendingConnections) {
if(isset($ueConfig['allowConnections']) && $ueConfig['allowConnections']) {
// $query = "SELECT count(*) FROM #__comprofiler_members WHERE pending=1 AND memberid=". (int) $_CB_framework->myId();
$query = "SELECT COUNT(*)"
. "\n FROM #__comprofiler_members AS m"
. "\n LEFT JOIN #__comprofiler AS c ON m.referenceid=c.id"
. "\n LEFT JOIN #__users AS u ON m.referenceid=u.id"
. "\n WHERE m.memberid=" . (int) $_CB_framework->myId() . " AND m.pending=1"
. "\n AND c.approved=1 AND c.confirmed=1 AND c.banned=0 AND u.block=0"
;
if(!$_CB_database->setQuery($query)) print $_CB_database->getErrorMsg();
$totalpendingconnections = $_CB_database->loadResult();
if($totalpendingconnections > 0) {
if ( !$horizontal ) echo '
";
}
}
}
if (!$horizontal) {
if ((!$avatarDisplayed) or ($avatar_position!="default") or ($pms)) $topMargin = "1.4em";
else $topMargin = "2px";
echo '
";
echo ""; // wondering if this was even neeeded:
";
// Add Authenticated Post text
if ( $logoutposttext ) {
if ( defined( $logoutposttext ) ) {
echo $cbUser->replaceUserVars(constant( $logoutposttext ));
} else {
echo $cbUser->replaceUserVars($logoutposttext);
}
echo "\n";
}
} else { // Login Form :
/**
* URLs computation:
*/
// redirect to site url (so cookies are recognized correctly after login):
if (strncasecmp($cblogin_live_site, "http://www.", 11)==0 // && strncasecmp($cblogin_live_site, "http://", 7)==0
&& strncasecmp( substr($cblogin_live_site, 11), substr($login, 7), $len_live_site - 11 ) == 0 ) {
// the login return string matches the live site without 'www.' in it:
// add www subdomain as live_site has it.
$login = "http://www." . substr($login, 7);
} elseif (strncasecmp($cblogin_live_site, "https://www.", 12)==0 // && strncasecmp($cblogin_live_site, "https://", 8)==0
&& strncasecmp( substr($cblogin_live_site, 12), substr($login, 8), $len_live_site - 12 ) == 0 ) {
$login = "https://www." . substr($login, 8); // same for https
/* However, we can't remove www in joomla 1.0.13+, because cookies would fail on domain test to allow for login:
} elseif (strncasecmp($cblogin_live_site, "http://", 7)==0 && strncasecmp($cblogin_live_site, "http://www.", 11)==0
&& strncasecmp( substr($cblogin_live_site, 7), substr($login, 11), $len_live_site - 7 ) == 0 ) {
$login = "http://" . substr($login, 11);
} elseif (strncasecmp($cblogin_live_site, "https://", 8)==0 && strncasecmp($cblogin_live_site, "https://www.", 12)==0
&& strncasecmp( substr($cblogin_live_site, 8), substr($login, 12), $len_live_site - 8 ) == 0 ) {
$login = "https://" . substr($login, 12);
*/
}
global $cbSpecialReturnAfterLogin;
if ( isset( $cbSpecialReturnAfterLogin ) ) {
$login = $cbSpecialReturnAfterLogin;
}
$login = cbSef( $login );
if ( $https_post > 1 /* && ! $isHttps */ ) {
if ((strncmp($login, "http:", 5)!=0) && (strncmp($login, "https:", 6)!=0)) {
$login = $cblogin_live_site . '/' . $login;
}
$login = str_replace("http://","https://",$login);
}
$loginPost = $_CB_framework->viewUrl( 'login' );
if ( $https_post /* && ! $isHttps */ ) {
if ( ( substr($loginPost, 0, 5) != "http:" ) && ( substr($loginPost, 0, 6) != "https:" ) ) {
$loginPost = $cblogin_live_site."/".$loginPost;
}
$loginPost = str_replace("http://","https://",$loginPost);
}
// now we need to make sure that the cookie in return of this post is sent to the most generic domain, in case multiple domains exist:
// if the current page ($return) is without www, then login should also be without www, even if live_site has www:
if (strncasecmp($loginPost, "http://www.", 11)==0 // && strncasecmp($cblogin_live_site, "http://", 7)==0
&& strncasecmp( substr($loginPost, 11), substr($return, 7), $len_live_site - 11 ) == 0 ) {
// the login return string matches the live site without 'www.' in it:
// add www subdomain as live_site has it.
$loginPost = "http://" . substr($loginPost, 11);
} elseif (strncasecmp($loginPost, "https://www.", 12)==0 // && strncasecmp($cblogin_live_site, "https://", 8)==0
&& strncasecmp( substr($loginPost, 12), substr($return, 8), $len_live_site - 12 ) == 0 ) {
$loginPost = "https://" . substr($loginPost, 12); // same for https
}
if ($show_lostpass) {
$urlLostPassword = $_CB_framework->viewUrl( 'lostpassword' );
if ( $https_post /* && ! $isHttps */ ) {
if ( ( substr($urlLostPassword, 0, 5) != "http:" ) && ( substr($urlLostPassword, 0, 6) != "https:" ) ) {
$urlLostPassword = $cblogin_live_site."/".$urlLostPassword;
}
$urlLostPassword = str_replace("http://","https://",$urlLostPassword);
}
} else {
$urlLostPassword = null;
}
// CB config may override the system configuration setting
$registration_enabled = $_CB_framework->getCfg( 'allowUserRegistration' );
if ( ! $registration_enabled ) {
if ( isset($ueConfig['reg_admin_allowcbregistration']) && $ueConfig['reg_admin_allowcbregistration'] == '1' ) {
$registration_enabled = true;
}
}
if ($registration_enabled && $show_newaccount) {
$urlRegister = $_CB_framework->viewUrl( 'registers' );
if ( $https_post /* && ! $isHttps */ ) {
if ( ( substr($urlRegister, 0, 5) != "http:" ) && ( substr($urlRegister, 0, 6) != "https:" ) ) {
$urlRegister = $cblogin_live_site."/".$urlRegister;
}
$urlRegister = str_replace("http://","https://",$urlRegister);
}
} else {
$urlRegister = null;
}
/**
* STRINGS:
*/
switch ( isset( $ueConfig['login_type'] ) ? $ueConfig['login_type'] : 0 ) {
case 2:
$userNameText = _UE_EMAIL;
break;
case 1:
// NEXT 3 LINES: CB 1.2 RC 2 + CB 1.2 specific : remove after !
if ( ! defined( '_UE_USERNAME_OR_EMAIL' ) ) {
DEFINE('_UE_USERNAME_OR_EMAIL','Username or email');
}
$userNameText = _UE_USERNAME_OR_EMAIL;
break;
case 0:
default:
$userNameText = _UE_USERNAME;
break;
}
if ($compact) {
$txtLostLogin = _UE_LOST_USERNAME_PASSWORD;
} else {
$txtLostLogin = ( ( $jVersion == -1 ) ? _UE_USERNAME_PASSWORD_REMINDER : _UE_LOST_USERNAME_PASSWORD );
}
/**
* STYLES and attributes:
*/
$bgstyleUser = '';
$bgstylePass = '';
if ( $compact ) {
if ( $show_username_pass_icons >= 1 ) {
$bgstyleUser .= ' style="background-image:url(' . $urlImgPath . 'username.png); background-repeat: no-repeat; background-position: 0px 0px; padding-left: 30px; min-height: 18px;width:auto;" ';
$bgstylePass .= ' style="background-image:url(' . $urlImgPath . 'password.png); background-repeat: no-repeat; background-position: 0px 0px; padding-left: 30px; min-height: 18px;width:auto;" ';
}
if ( $show_username_pass_icons <= 1 ) {
$bgstyleUser .= " alt=\"" . htmlspecialchars( $userNameText ) . "\" value=\"" . htmlspecialchars( $userNameText ) . "\" "
. "onfocus=\"if (this.value=='" . addslashes( $userNameText ) . "') this.value=''\" onblur=\"if(this.value=='') { this.value='" . addslashes( $userNameText ) . "'; return false; }\""
;
$bgstylePass .= " alt=\""._UE_PASS."\" value=\"paswww\" onfocus=\"if (this.value=='paswww') this.value=''\" onblur=\"if(this.value=='') { this.value='paswww'; return false; }\""
;
}
} else {
if ( $show_username_pass_icons == 2 ) {
$bgstyleUser .= ' style="vertical-align:top;" ';
$bgstylePass .= ' style="vertical-align:top;" ';
}
$txtusername = '
'
;
$txtpassword = '
'
;
}
if ( $compact || ( $show_username_pass_icons == 2 ) ) {
$bgstyleUser .= ' title="' . $userNameText . '"';
$bgstylePass .= ' title="' . _UE_PASS . '"';
}
/**
* CSS classes and IDs:
*/
$idFormLogin = ( $jVersion == 2 ? 'login-form' : 'mod_loginform' ) . $id_sfx;
/**
* If CB Integrations up, FIRE onAfterLoginForm CB event:
*/
$pluginDisplays = array();
if ( $cb_plugins ) {
include_once( $absolute_path . "/administrator/components/com_comprofiler/plugin.class.php");
global $_PLUGINS;
$_PLUGINS->loadPluginGroup('user');
$pluginsResults = $_PLUGINS->trigger( 'onAfterLoginForm', array( $name_lenght, $pass_lenght, $horizontal, $class_sfx, &$params ) );
if ( count( $pluginsResults ) > 0 ) {
foreach ( $pluginsResults as $pR ) {
if ( is_array( $pR ) ) {
foreach ($pR as $pK => $pV ) {
$pluginDisplays[$pK][] = $pV;
}
} elseif ( $pR != '' ) {
$pluginDisplays['beforeButton'][] = $pR;
}
}
}
foreach ( $pluginDisplays as $pK => $pV ) {
$divHtml = ( $horizontal ? '
';
$sldivHtml = ( $horizontal ? '' : '
' );
$pluginDisplays[$pK] = $divHtml . implode( $sldivHtml . $divHtml, $pV ) . $sldivHtml;
}
}
/**
* LOGIN FORM VIEW:
*/
echo '
";
if ( isset( $pluginDisplays['almostEnd'] ) ) {
echo $pluginDisplays['almostEnd'];
}
if ( $posttext ) {
if ( defined( $posttext ) ) {
echo constant( $posttext );
} else {
echo $posttext;
}
echo "\n";
}
}
?>