Ejemplo n.º 1
0
 public function getRememberMe()
 {
     $db = JFactory::getDbo();
     $db->setQuery("SELECT params from #__modules WHERE module = 'mod_cblogin' ORDER BY ordering", 0, 1);
     $raw_params = $db->loadResult();
     $params = new cbParamsBase($raw_params);
     return $params->get('remember_enabled', 1);
 }
Ejemplo n.º 2
0
	public function getRememberMe() {
		$db = JFactory::getDbo();
		// TODO: test if works (see #1079)
		$db->setQuery( "SELECT params FROM #__extensions WHERE element='mod_cblogin' AND type='module'", 0, 1 );
		$raw_params = $db->loadResult();
		$params = new cbParamsBase( $raw_params );
		return $params->get( 'remember_enabled', 1);
	}
Ejemplo n.º 3
0
	function _form_mos_menu__menutypes() {
		global $_CB_database;

		$query		=	"SELECT params"
					.	"\n FROM #__modules"
					.	"\n WHERE module = 'mod_mainmenu'"
					//.	"\n ORDER BY title"
					;
		$_CB_database->setQuery( $query	);
		$modMenus	=	$_CB_database->loadObjectList();

		$query		=	"SELECT menutype"
					.	"\n FROM #__menu"
					.	"\n GROUP BY menutype"
					//.	"\n ORDER BY menutype"
					;
		$_CB_database->setQuery( $query	);
		$menuMenus	=	$_CB_database->loadResultArray();

		$menuTypes	=	array();

		foreach ( $modMenus as $modMenu ) {
			$modParams 		=	new cbParamsBase( $modMenu->params );
			$menuType 		=	$modParams->get( 'menutype' );
			if ( ! $menuType ) {
				$menuType	=	'mainmenu';
			}
			if ( ! in_array( $menuType, $menuTypes ) ) {
				$menuTypes[] =	$menuType;
			}
		}

		foreach ( $menuMenus as $menuType ) {
			if ( ! in_array( $menuType, $menuTypes ) ) {
				$menuTypes[] =	$menuType;
			}
		}

		asort( $menuTypes );
		return $menuTypes;
	}
Ejemplo n.º 4
0
	/**
	 * Creates the column references for the userlist query
	 * @static
	 *
	 * @param  array         $columns
	 * @param  array         $allFields
	 * @param  array         $tables
	 * @param  array         $searchableFields
	 * @param  cbParamsBase  $params
	 * @return string
	 */
	function getFieldsSQL( &$columns, &$allFields, &$tables, &$searchableFields, &$params ){
		$colRefs										=	array();
	
		$newtableindex									=	0;
	
		$list_search									=	(int) $params->get( 'list_search', 1 );
	
		foreach ( $columns as $i => $column ) {
			foreach ( $column->fields as $k => $fieldid ) {
				if ( isset( $allFields[$fieldid] ) ) {
					// now done in field fetching:
					//	if ( ! is_object( $allFields[$fieldid]->params ) ) {
					//		$allFields[$fieldid]->params	=	new cbParamsBase( $allFields[$fieldid]->params );
					//	}
					$field								=	$allFields[$fieldid];
					if ( ! array_key_exists( $field->table, $tables ) ) {
						$newtableindex++;
						$tables[$field->table]			=  't'.$newtableindex;
					}
	/*
					if ( $field->name == 'avatar' ) {
						$colRefs['avatarapproved']		=	'ue.`avatarapproved`';
						$colRefs['name']				=	'u.`name`';
						$colRefs['username']			=	'******';
					}
					if ( $field->type == 'formatname' ) {
						$colRefs['name']				=	'u.`name`';
						$colRefs['username']			=	'******';
					}
	*/
					if ( ( $tables[$field->table][0] != 'u' ) && ( $field->name != 'NA' ) ) {		// CB 1.1 table compatibility : TBD: remove after CB 1.2
						foreach ( $field->getTableColumns() as $col ) {
							$colRefs[$col]				=	$tables[$field->table] . '.' . $field->_db->NameQuote( $col );
						}
					}
					if ( $field->searchable && ( $list_search == 1 ) ) {
						$searchableFields[]				=&	$allFields[$fieldid];
					}
					$allFields[$fieldid]->_listed		=	true;
				} else {
					// field unpublished or deleted but still in list: remove field from columns, so that we don't handle it:
					unset( $columns[$i]->fields[$k] );
				}
			}
		}
	
		if ( $list_search == 2 ) {
			foreach ( $allFields as $fieldid => $field ) {
				if ( $field->searchable ) {
					$searchableFields[]					=&	$allFields[$fieldid];
				}
			}
		}
		return implode( ', ', $colRefs );
	}
/**
 * Checks if a page is executed https, and if not, if it should be according to login module HTTPS posts specifications
 * 
 * @param  boolean  $return  [default: false] : True: returns if https switchover is needed for the POST form (if not already on HTTPS and login module asks for it). False: errors 403 if not in https and it's configured in login module.
 * @return boolean           True: switchover needed (returned only if $return = true)
 */
function checkCBPostIsHTTPS($return = false)
{
    global $_CB_framework, $_CB_database, $_SERVER;
    $isHttps = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off';
    if (!$isHttps && file_exists($_CB_framework->getCfg('absolute_path') . '/modules/' . (checkJversion() > 0 ? 'mod_cblogin/' : null) . 'mod_cblogin.php')) {
        $query = 'SELECT ' . $_CB_database->NameQuote('params') . "\n FROM " . $_CB_database->NameQuote('#__modules') . "\n WHERE " . $_CB_database->NameQuote('module') . " = " . $_CB_database->Quote('mod_cblogin') . "\n ORDER BY " . $_CB_database->NameQuote('ordering');
        $_CB_database->setQuery($query, 0, 1);
        $module = $_CB_database->loadResult();
        if ($module) {
            $params = new cbParamsBase($module);
            $https_post = $params->get('https_post', 0) != 0;
        } else {
            $https_post = false;
        }
    } else {
        $https_post = false;
    }
    if ($return) {
        return $https_post;
    } else {
        if ($https_post && !$isHttps) {
            header('HTTP/1.0 403 Forbidden');
            exit(_UE_NOT_AUTHORIZED);
        }
    }
}